initial sketch
[gemrepl.git] / gemscgi.h
blob474c1b8b95021aa043129ffd0d7e7795386e7afd
1 #include <stddef.h>
3 typedef struct Request_Info {
4 const char *query_string_decoded;
5 const char *script_path;
6 const char *path_info;
7 const char *server_name;
8 const char *server_port;
9 const char *remote_addr;
10 const char *tls_client_hash;
11 const char *tls_client_issuer;
12 const char *tls_client_issuer_cn;
13 const char *tls_client_subject;
14 const char *tls_client_subject_cn;
15 } Request_Info;
17 typedef void write_response_cb(const void *object, const char* buf, size_t n);
18 typedef void respond_cb(void *object, const Request_Info *request_info,
19 write_response_cb write_response, const void *write_response_object);
21 /* Create a socket at `socket_path` and accept valid SCGI requests with empty
22 * body; for each such, `respond` will be called with `respond_object` and a
23 * `Request_Info` struct filled in according to the request headers. This
24 * should generate a response by calling arbitrarily often `write_response`,
25 * passing `write_response_object` each time. */
26 void runSCGI(const char *socket_path, respond_cb respond, void *respond_object);