Browse Source

Allow CGI to handle other requests with body than POST/PUT (fix TODO)

bel 9 years ago
parent
commit
d71b2d9379
1 changed files with 2 additions and 5 deletions
  1. 2 5
      src/civetweb.c

+ 2 - 5
src/civetweb.c

@@ -7118,11 +7118,8 @@ handle_cgi_request(struct mg_connection *conn, const char *prog)
 	setbuf(err, NULL);
 	fout.fp = out;
 
-	/* Send POST or PUT data to the CGI process if needed */
-	/* TODO(high): Methods like PATCH, MKCOL, ... also have body data. */
-	if (!mg_strcasecmp(conn->request_info.request_method, "POST")
-	    || !mg_strcasecmp(conn->request_info.request_method, "PUT")) {
-		/* This is a POST/PUT request */
+	if ((conn->request_info.content_length > 0) || conn->is_chunked) {
+		/* This is a POST/PUT request, or another request with body data. */
 		if (!forward_body_data(conn, in, INVALID_SOCKET, NULL)) {
 			/* Error sending the body data */
 			mg_cry(conn,