set FD_CLOEXEC
[gemrepl.git] / gemscgi.h
blob3b25aed2a117b78646894759e0b01c7fa5204333
1 #include <stddef.h>
3 typedef struct Request_Info {
4 // url decoded query string:
5 const char *query_string_decoded;
7 const char *script_path;
8 const char *path_info;
9 const char *server_name;
10 const char *server_port;
11 const char *remote_addr;
13 // tls client hash with any 'SHA256:' prefix stripped.
14 // At least with molly-brown and GLV-1.12556, this will be the sha256 hash
15 // of the certificate as a 64 character hex string.
16 const char *tls_client_hash;
18 const char *tls_client_issuer;
19 const char *tls_client_issuer_cn;
20 const char *tls_client_subject;
21 const char *tls_client_subject_cn;
22 } Request_Info;
24 typedef void write_response_cb(const void *object, const char* buf, size_t n);
25 typedef void respond_cb(void *object, const Request_Info *request_info,
26 int socket);
28 /* Create a socket at `socket_path` and accept valid SCGI requests with empty
29 * body; for each such, `respond` will be called with `respond_object` and a
30 * `Request_Info` struct filled in according to the request headers. This
31 * should write its response to the fd `socket`. */
32 void runSCGI(const char *socket_path, respond_cb respond, void *respond_object);