Browse Source

Added/fixed chunked encoded transfer

personal/stbuehler/wip
Stefan Bühler 14 years ago
parent
commit
4a5aa5361e
  1. 3
      include/lighttpd/base.h
  2. 6
      src/connection.c
  3. 3
      src/filter_chunked.c

3
include/lighttpd/base.h

@ -46,8 +46,9 @@
#include <lighttpd/connection.h>
#include <lighttpd/network.h>
#include <lighttpd/filter_chunked.h>
#include <lighttpd/collect.h>
#include <lighttpd/network.h>
#include <lighttpd/utils.h>
#define SERVER_VERSION ((guint) 0x01FF0000)

6
src/connection.c

@ -36,7 +36,11 @@ static void forward_response_body(connection *con) {
response_send_headers(con);
}
chunkqueue_steal_all(con->raw_out, con->out);
if (vr->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
filter_chunked_encode(con, con->raw_out, con->out);
} else {
chunkqueue_steal_all(con->raw_out, con->out);
}
if (con->out->is_closed) con->raw_out->is_closed = TRUE;
if (con->raw_out->length > 0) {
ev_io_add_events(con->wrk->loop, &con->sock_watcher, EV_WRITE);

3
src/filter_chunked.c

@ -31,10 +31,11 @@ handler_t filter_chunked_encode(connection *con, chunkqueue *out, chunkqueue *in
if (in->length > 0) {
http_chunk_append_len(out, in->length);
chunkqueue_steal_all(out, in);
chunkqueue_append_mem(out, CONST_STR_LEN("\r\n"));
}
if (in->is_closed) {
if (!out->is_closed) {
chunkqueue_append_mem(out, CONST_STR_LEN("0\r\n"));
chunkqueue_append_mem(out, CONST_STR_LEN("0\r\n\r\n"));
out->is_closed = TRUE;
}
return HANDLER_GO_ON;

Loading…
Cancel
Save