Remove the limit on size of HTTP headers by removing static buffers

svn:r1240
This commit is contained in:
Niels Provos 2009-04-24 16:08:30 +00:00
parent 749f4ce319
commit 23967f73a2
2 changed files with 4 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Changes in 1.4.11-stable:
o Fix a bug when removing a timeout from the heap. [Patch from Marko Kreen]
o Remove the limit on size of HTTP headers by removing static buffers.
Changes in 1.4.10-stable:
o clean up buffered http connection data on reset; reported by Brian O'Kelley

12
http.c
View File

@ -378,16 +378,14 @@ static void
evhttp_make_header_request(struct evhttp_connection *evcon,
struct evhttp_request *req)
{
char line[1024];
const char *method;
evhttp_remove_header(req->output_headers, "Proxy-Connection");
/* Generate request line */
method = evhttp_method(req->type);
evutil_snprintf(line, sizeof(line), "%s %s HTTP/%d.%d\r\n",
evbuffer_add_printf(evcon->output_buffer, "%s %s HTTP/%d.%d\r\n",
method, req->uri, req->major, req->minor);
evbuffer_add(evcon->output_buffer, line, strlen(line));
/* Add the content length on a post request if missing */
if (req->type == EVHTTP_REQ_POST &&
@ -464,11 +462,9 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
struct evhttp_request *req)
{
int is_keepalive = evhttp_is_connection_keepalive(req->input_headers);
char line[1024];
evutil_snprintf(line, sizeof(line), "HTTP/%d.%d %d %s\r\n",
evbuffer_add_printf(evcon->output_buffer, "HTTP/%d.%d %d %s\r\n",
req->major, req->minor, req->response_code,
req->response_code_line);
evbuffer_add(evcon->output_buffer, line, strlen(line));
if (req->major == 1) {
if (req->minor == 1)
@ -515,7 +511,6 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
void
evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
{
char line[1024];
struct evkeyval *header;
/*
@ -529,9 +524,8 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
}
TAILQ_FOREACH(header, req->output_headers, next) {
evutil_snprintf(line, sizeof(line), "%s: %s\r\n",
evbuffer_add_printf(evcon->output_buffer, "%s: %s\r\n",
header->key, header->value);
evbuffer_add(evcon->output_buffer, line, strlen(line));
}
evbuffer_add(evcon->output_buffer, "\r\n", 2);