httpd icon indicating copy to clipboard operation
httpd copied to clipboard

POST requests not working in FastCGI - with potential fix

Open brendonm opened this issue 10 years ago • 2 comments

When a POST request is sent to httpd, none of the Content-X headers are being sent through FastCGI, and I'm not sure that the content itself is sent either. This effectively eliminates the possibility of using form submissions, which are a very important part of any web application.

brendonm avatar Jun 25 '15 21:06 brendonm

To clarify, the Content-Type and Content-Length headers are being sent through FastCGI as CONTENT_TYPE and CONTENT_LENGTH respectively. This differs from the nginx implementation which also includes them as HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH.

It is preferable from an application point of view to have these headers come through with HTTP_ prefix, as they can then use this prefix to show all the headers sent from the client without having to apply additional logic.

brendonm avatar Jun 30 '15 02:06 brendonm

Possible fix could be to comment out the following lines:

httpd/server_fcgi.c: 649

// if (strcasecmp(key, "Content-Length") == 0 || // strcasecmp(key, "Content-Type") == 0) { // if ((name = strdup(key)) == NULL) // return (-1); // } else { if (asprintf(&name, "HTTP_%s", key) == -1) return (-1); // }

brendonm avatar Jun 30 '15 02:06 brendonm