aboutsummaryrefslogtreecommitdiff
path: root/fcgi.c
diff options
context:
space:
mode:
Diffstat (limited to 'fcgi.c')
-rw-r--r--fcgi.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fcgi.c b/fcgi.c
index fe4db2f..ddb4af6 100644
--- a/fcgi.c
+++ b/fcgi.c
@@ -456,13 +456,28 @@ err:
void
send_fcgi_req(struct fcgi *f, struct client *c)
{
+ char addr[NI_MAXHOST];
+ const char *t;
+ int e;
+
+ e = getnameinfo((struct sockaddr*)&c->addr, sizeof(c->addr),
+ addr, sizeof(addr),
+ NULL, 0,
+ NI_NUMERICHOST);
+ if (e != 0)
+ fatal("getnameinfo failed");
+
c->next = NULL;
fcgi_begin_request(f->fd, c->id);
- fcgi_send_param(f->fd, c->id, "QUERY_STRING", c->iri.query);
fcgi_send_param(f->fd, c->id, "GEMINI_URL_PATH", c->iri.path);
+ fcgi_send_param(f->fd, c->id, "QUERY_STRING", c->iri.query);
+ fcgi_send_param(f->fd, c->id, "REMOTE_ADDR", addr);
+ fcgi_send_param(f->fd, c->id, "REMOTE_HOST", addr);
+ fcgi_send_param(f->fd, c->id, "REQUEST_METHOD", "");
+ fcgi_send_param(f->fd, c->id, "SERVER_NAME", c->iri.host);
+ fcgi_send_param(f->fd, c->id, "SERVER_PROTOCOL", "GEMINI");
fcgi_send_param(f->fd, c->id, "SERVER_SOFTWARE", "gmid/1.7");
- /* ... */
if (fcgi_end_param(f->fd, c->id) == -1)
close_all(f);