commit - 911156fb95c43b9aa3c4cec8f9e40317ae7e0807
commit + fef06f06ac4779731bb8e293248eae1883a7ed1b
blob - e29c7135e1906ec838ffb0ec272bce1435614cf2
blob + 9452e306aa4eb3545ae87c9a4dd30836e029723a
--- fcgi.c
+++ fcgi.c
#include "log.h"
-/*
- * Sometimes it can be useful to inspect the fastcgi traffic as
- * received by gmid.
- *
- * This will make gmid connect to a `debug.sock' socket (that must
- * exists) in the current directory and send there a copy of what gets
- * read. The socket can be created and monitored e.g. with
- *
- * rm -f debug.sock ; nc -Ulk ./debug.sock | hexdump -C
- *
- * NB: the sandbox must be disabled for this to work.
- */
-#define DEBUG_FCGI 0
-
-#if DEBUG_FCGI
-# include <sys/un.h>
-static int debug_socket = -1;
-#endif
-
struct fcgi_header {
unsigned char version;
unsigned char type;
struct fcgi_header hdr;
struct fcgi_end_req_body end;
size_t len;
-
-#if DEBUG_FCGI
- if (debug_socket == -1) {
- struct sockaddr_un addr;
- if ((debug_socket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
- fatal("socket");
-
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- strlcpy(addr.sun_path, "./debug.sock", sizeof(addr.sun_path));
- if (connect(debug_socket, (struct sockaddr*)&addr, sizeof(addr))
- == -1)
- fatal("connect");
- }
-#endif
-
for (;;) {
if (EVBUFFER_LENGTH(src) < sizeof(hdr))
return;
if (EVBUFFER_LENGTH(src) < sizeof(hdr) + len + hdr.padding)
return;
-#if DEBUG_FCGI
- write(debug_socket, EVBUFFER_DATA(src),
- sizeof(hdr) + len + hdr.padding);
-#endif
-
evbuffer_drain(src, sizeof(hdr));
switch (hdr.type) {