- finally! the fix for 948.

only run into the 404 handler if we are in direct connection mode.
  that way we cant run into the 404 handler if a fastcgi app returned a
  404.

  This is a small backwards incompatible change as now the *cgi app has
  to generate the content for the 404 itself instead of falling back
  into the 404-handler.

  There is still a problem with subrequest which go back to the same
  module (fastcgi app triggers subrequest which hits the fastcgi module
  again) but that would require bigger changes to the plugin api. ATM
  each plugin deinitialize its data after it handled the request. So the
  module isnt initialized for the connection anymore and the subrequest
  directly jumps out of the handler.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1904 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.17
Marcus Rückert 15 years ago
parent bafcebe06d
commit baec632cb7
  1. 66
      src/connections.c

@ -1412,48 +1412,42 @@ int connection_state_machine(server *srv, connection *con) {
switch (r = http_response_prepare(srv, con)) {
case HANDLER_FINISHED:
if (con->http_status == 404 ||
con->http_status == 403) {
/* 404 error-handler */
if (con->in_error_handler == 0 &&
(!buffer_is_empty(con->conf.error_handler) ||
!buffer_is_empty(con->error_handler))) {
/* call error-handler */
con->error_handler_saved_status = con->http_status;
con->http_status = 0;
if (buffer_is_empty(con->error_handler)) {
buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
} else {
buffer_copy_string_buffer(con->request.uri, con->error_handler);
}
buffer_reset(con->physical.path);
if (con->mode == DIRECT) {
if (con->http_status == 404 ||
con->http_status == 403) {
/* 404 error-handler */
con->in_error_handler = 1;
if (con->in_error_handler == 0 &&
(!buffer_is_empty(con->conf.error_handler) ||
!buffer_is_empty(con->error_handler))) {
/* call error-handler */
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
con->error_handler_saved_status = con->http_status;
con->http_status = 0;
done = -1;
break;
} else if (con->in_error_handler) {
/* error-handler is a 404 */
if (buffer_is_empty(con->error_handler)) {
buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
} else {
buffer_copy_string_buffer(con->request.uri, con->error_handler);
}
buffer_reset(con->physical.path);
con->http_status = con->error_handler_saved_status;
}
} else if (con->in_error_handler) {
/* error-handler is back and has generated content */
/* if Status: was set, take it otherwise use 200 */
/* the default should be 200 for now.
but this breaks 948 again. solution
pending
if (con->http_status == 0) {
con->http_status = con->error_handler_saved_status;
con->in_error_handler = 1;
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
done = -1;
break;
} else if (con->in_error_handler) {
/* error-handler is a 404 */
con->http_status = con->error_handler_saved_status;
}
} else if (con->in_error_handler) {
/* error-handler is back and has generated content */
/* if Status: was set, take it otherwise use 200 */
}
*/
}
if (con->http_status == 0) con->http_status = 200;
/* we have something to send, go on */

Loading…
Cancel
Save