summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2009-10-16 09:03:03 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2009-10-16 09:03:03 +0000
commitd2a5467fa478f950e99aa67e94db418f956371d5 (patch)
tree1a2e0228d6d297f2099373bbcbfa1e5331906c9a
parent32b16b0ff422aadef88090e2686650c3f1b80ba0 (diff)
downloadlighttpd-d2a5467fa478f950e99aa67e94db418f956371d5.tar.gz
Fix con-state machine error handling (leave states after errors)
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2659 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--src/connections.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/connections.c b/src/connections.c
index 840d2639..214b85ab 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -856,16 +856,15 @@ static handler_t connection_handle_fdevent(void *s, void *context, int revents)
joblist_append(srv, con);
break;
case CON_STATE_ERROR:
- ERROR("we are in (CON_STATE_ERROR), but still get a FDEVENT_OUT, removing event from fd = %d, %04x for (%s)"
-,
- con->sock->fd,
- revents,
- SAFE_BUF_STR(con->uri.path));
+ ERROR("we are in (CON_STATE_ERROR), but still get a FDEVENT_OUT, removing event from fd = %d, %04x for (%s)",
+ con->sock->fd,
+ revents,
+ SAFE_BUF_STR(con->uri.path));
- fdevent_event_del(srv->ev, con->sock);
+ fdevent_event_del(srv->ev, con->sock);
- joblist_append(srv, con);
- break;
+ joblist_append(srv, con);
+ break;
default:
TRACE("got FDEVENT_OUT for state %d, calling the job-handler, let's see what happens", con->state);
joblist_append(srv, con);
@@ -1278,11 +1277,15 @@ void connection_state_machine(server *srv, connection *con) {
return;
default:
/* something strange happened */
- TRACE("%s", "(error)");
+ if (con->conf.log_request_handling) {
+ TRACE("%s", "handle response header failed");
+ }
connection_set_state(srv, con, CON_STATE_ERROR);
break;
}
+ if (con->state == CON_STATE_ERROR) break;
+
/* all the response-headers are set, check if we have a */
connection_set_state(srv, con, CON_STATE_WRITE_RESPONSE_HEADER);
@@ -1320,11 +1323,15 @@ void connection_state_machine(server *srv, connection *con) {
break;
default:
/* something strange happened */
- TRACE("%s", "(error)");
+ if (con->conf.log_request_handling) {
+ TRACE("%s", "read response content failed");
+ }
connection_set_state(srv, con, CON_STATE_ERROR);
break;
}
+ if (con->state == CON_STATE_ERROR) break;
+
/* we might have new content in the con->send buffer
* encode it for the network
* - chunking
@@ -1339,11 +1346,15 @@ void connection_state_machine(server *srv, connection *con) {
return;
default:
/* something strange happened */
- TRACE("%s", "(error)");
+ if (con->conf.log_request_handling) {
+ TRACE("%s", "filter response content failed");
+ }
connection_set_state(srv, con, CON_STATE_ERROR);
break;
}
+ if (con->state == CON_STATE_ERROR) break;
+
/* copy output from filters into send_raw. */
bytes_moved = filter_chain_copy_output(con->send_filters, con->send_raw);