web_respond

HTTP レスポンスを返す

web_respond status, "ctype", "body"

status  : HTTP ステータスコード (200 等)
"ctype" : Content-Type ("text/html", "application/json" 等)
"body"  : 応答 body 文字列

(プラグイン / モジュール : hspwebsrv.dll)

解説

直前の web_accept で受信したリクエストに対するレスポンスを送信します。

例:
  web_respond 200, "application/json", "{\"ok\":true}"

関連項目

web_acceptリクエストを 1 件受け取る(hspwebsrv.dll)

サンプル逆引き (2)

sample_webserver.hsp
sample_websocket.hsp

情報

プラグイン / モジュールhspwebsrv.dll
バージョン1.0
作成日2026-04-15
著作者IronHSP / iron_webserver
URLhttps://github.com/inovia/IronHSP
備考iron_webserver.hsp は hspwebsrv.dll (Windows HTTP Server API v2 =
HTTP.sys 経由) をラップした HSP 向け本格 HTTP サーバモジュールです。
C# の HttpListener と同じ backend を使っているため、HTTP / HTTPS /
WebSocket を単一 DLL で扱えます。

#include "iron_webserver.hsp"

特徴:
HTTP.sys (kernel-mode) backend による高性能処理
http://localhost:port/ は admin 権限不要
http://+:port/ などは admin 必要 (netsh http add urlacl)
HTTPS は事前に netsh http add sslcert で証明書バインドが必要
WebSocket の handshake + フレーム parser も内包
タイプ拡張命令
グループiron_webserver ― HTTP
対応環境
  • その他 : Win32 / Win64
hs ファイルhsphelp\iron_webserver.hs