Menu ▾ ▴

#3 POST with a CGI script causing NS_ERROR_NET_RESET

v1.0 (example)
open
nobody
None
2
3 days ago
3 days ago
karasys
No

There is a bug when using POST with a CGI script, this is causing NS_ERROR_NET_RESET.
The problem lies in the do_cgi function: after processing POST input, it calls finish_request(0) prematurely, executing a shutdown on the connection before the CGI script has had a chance to send a response, causing the browser to report NS_ERROR_NET_RESET or connection reset.
Patch content (applicable to most versions, including v1.30):

--- mini_httpd.c.org
+++ mini_httpd.c
@@ -1842,7 +1842,8 @@
/* Interposer process. */
(void) close( p[0] );
cgi_interpose_input( p[1] );

  • finish_request( 0 );
    +// finish_request( 0 );
  • exit ( 0 );

Discussion


Log in to post a comment.