handle connection-close after after a broken header in keep-alive like

{{{
GET / HTTP/1.1
Host: foo

GET
}}}


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1328 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.12
Jan Kneschke 17 years ago
parent b2239df913
commit a3542afd31

@ -216,7 +216,7 @@ static int connection_handle_read_ssl(server *srv, connection *con) {
if (len > 0) {
b->used = len;
b->ptr[b->used++] = '\0';
/* we move the buffer to the chunk-queue, no need to free it */
chunkqueue_append_buffer_weak(con->read_queue, b);
@ -839,6 +839,7 @@ int connection_handle_read_state(server *srv, connection *con) {
off_t last_offset;
chunkqueue *cq = con->read_queue;
chunkqueue *dst_cq = con->request_content_queue;
int is_closed = 0; /* the connection got closed, if we don't have a complete header, -> error */
if (con->is_readable) {
con->read_idle_ts = srv->cur_ts;
@ -847,15 +848,8 @@ int connection_handle_read_state(server *srv, connection *con) {
case -1:
return -1;
case -2:
/* remote side closed the connection
* if we still have content, handle it, if not leave here */
if (cq->first == cq->last &&
(!cq->first || cq->first->mem->used == 0)) {
/* conn-closed, leave here */
connection_set_state(srv, con, CON_STATE_ERROR);
}
is_closed = 1;
break;
default:
break;
}
@ -1125,6 +1119,12 @@ int connection_handle_read_state(server *srv, connection *con) {
break;
}
/* the connection got closed and we didn't got enough data to leave one of the READ states
* the only way is to leave here */
if (is_closed && ostate == con->state) {
connection_set_state(srv, con, CON_STATE_ERROR);
}
chunkqueue_remove_finished_chunks(cq);
return 0;

Loading…
Cancel
Save