diff options
Diffstat (limited to 'src/fconn_fastcgi.c')
-rw-r--r-- | src/fconn_fastcgi.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/fconn_fastcgi.c b/src/fconn_fastcgi.c index e0f4132..2e37371 100644 --- a/src/fconn_fastcgi.c +++ b/src/fconn_fastcgi.c @@ -33,7 +33,7 @@ static void handle_get_values(fconn_fastcgi *c, fcgy_req *req, fastcgi_header h, static void handle_begin_request(fconn_fastcgi *c, fcgy_req *req, fastcgi_header h, const char *buf) { if(h.requestId == 0 || h.contentLength < 8 || *buf != 0 || buf[1] < 1 || buf[1] > 3) { - fprintf(stderr, "Invalid BEGIN_REQUEST record\n"); + ywarn("Invalid BEGIN_REQUEST record, disconnecting front-end."); fconn_fastcgi_destroy(c); return; } @@ -41,7 +41,7 @@ static void handle_begin_request(fconn_fastcgi *c, fcgy_req *req, fastcgi_header size_t n; vec_search_insert(c->reqs, n, req_cmp(c, h.requestId)); if(n < c->reqs.n && c->reqs.a[n]->fconn_id == h.requestId) { - fprintf(stderr, "BEGIN_REQUEST record for existing request ID\n"); + ywarn("BEGIN_REQUEST record for existing request ID, disconnecting front-end."); fconn_fastcgi_destroy(c); return; } @@ -64,7 +64,7 @@ static void handle_params(fconn_fastcgi *c, fcgy_req *req, fastcgi_header h, con while(len > 0) { n = fastcgi_param_parse(c->pp, buf, len); if(n < 0) { - fprintf(stderr, "Invalid parameter\n"); + ywarn("Invalid parameter, disconnecting front-end."); fconn_fastcgi_destroy(c); return; } @@ -88,12 +88,13 @@ static void read_cb(fastcgi_reader *r, ssize_t len, fastcgi_header h, const char fconn_fastcgi *c = r->data; if(len < 0) { - fprintf(stderr, "Read error: %s\n", strerror(errno)); + if(errno != ECONNRESET || c->reqs.n) + ywarn("Unexpected connection error: %s", strerror(errno)); fconn_fastcgi_destroy(c); return; } - fprintf(stderr, "Got FastCGI record: len = %4u, version = %u, type = %2u, requestId = %2u, contentLength = %4u\n", + ytrace("Got FastCGI record: len = %4u, version = %u, type = %2u, requestId = %2u, contentLength = %4u\n", (unsigned)len, (unsigned)h.version, (unsigned)h.type, (unsigned)h.requestId, (unsigned)h.contentLength); static const struct { @@ -117,7 +118,7 @@ static void read_cb(fastcgi_reader *r, ssize_t len, fastcgi_header h, const char } if(!handler) { - fprintf(stderr, "Unknown record type %u\n", (unsigned)h.type); + ydebug("Received record with unknown type %u\n", (unsigned)h.type); /* TODO: Reply with FCGI_UNKNOWN_TYPE */ return; } @@ -126,7 +127,7 @@ static void read_cb(fastcgi_reader *r, ssize_t len, fastcgi_header h, const char if(handler->req) { vec_search(c->reqs, req_cmp(c, h.requestId), req = c->reqs.a[i]); if(!req) { - fprintf(stderr, "Received record for unknown request id (type = %u, id = %u)\n", (unsigned)h.type, (unsigned)h.requestId); + ywarn("Received record for unknown request id (type = %u, id = %u), disconnecting front-end.\n", (unsigned)h.type, (unsigned)h.requestId); fconn_fastcgi_destroy(c); return; } |