commit - f624e3f7a3b025c5bb3f32b8762ba05ddc0ba81d
commit + 2bd8d56a2d5e8d637430d608e9944a4b08e20187
blob - 3ec4aee067d2084604a4b3ca1fa315b83811ccc3
blob + c2c1ee12bd8c2ba3ff07a94f5979543839420273
--- gotwebd/fcgi.c
+++ gotwebd/fcgi.c
switch (errno) {
case EINTR:
case EAGAIN:
+ event_add(&c->ev, NULL);
return;
default:
goto fail;
}
break;
-
case 0:
- log_info("closed connection");
- goto fail;
+ if (c->sock->client_status == CLIENT_CONNECT) {
+ log_warnx("client %u closed connection too early",
+ c->request_id);
+ goto fail;
+ }
+ return;
default:
break;
}
}
} while (parsed > 0 && c->buf_len > 0);
+ event_add(&c->ev, NULL);
return;
fail:
fcgi_cleanup_request(c);
c->resp_fd = pipe[1];
c->resp_event = resp_event;
+ c->sock->client_status = CLIENT_REQUEST;
}
void
blob - 27a53cfbf3baff7f391f1445c503ba9712923fc6
blob + 162669e54b0d2cd54061611b7096173f4479eb6d
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
enum client_action {
CLIENT_CONNECT,
+ CLIENT_REQUEST,
CLIENT_DISCONNECT,
};
blob - 008faf6facb0837fc7b7e84fa8accffa90f1dbd7
blob + 545307fa76d787a29d9bccaa41f4477b40f86c9f
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
c->sock->client_status = CLIENT_CONNECT;
c->request_id = get_request_id();
- event_set(&c->ev, s, EV_READ|EV_PERSIST, fcgi_request, c);
+ event_set(&c->ev, s, EV_READ, fcgi_request, c);
event_add(&c->ev, NULL);
evtimer_set(&c->tmo, fcgi_timeout, c);