diff options
author | Arno Töll <arno@debian.org> | 2012-11-21 23:03:47 +0100 |
---|---|---|
committer | Arno Töll <arno@debian.org> | 2012-11-21 23:03:47 +0100 |
commit | a4197a3a45fd2b20d05c079d49af9fbef5fd4e2e (patch) | |
tree | 6777fddb60ecea91715e0ce39298a8366c27a40d /src/request.c | |
parent | 0f22664a8c9f92c8b7d5dd05772bacf7caecbd52 (diff) | |
download | lighttpd-a4197a3a45fd2b20d05c079d49af9fbef5fd4e2e.tar.gz |
Imported Upstream version 1.4.16upstream/1.4.16
Diffstat (limited to 'src/request.c')
-rw-r--r-- | src/request.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/request.c b/src/request.c index f76252e..92660a0 100644 --- a/src/request.c +++ b/src/request.c @@ -284,8 +284,6 @@ int http_request_parse(server *srv, connection *con) { int done = 0; - data_string *ds = NULL; - /* * Request: "^(GET|POST|HEAD) ([^ ]+(\\?[^ ]+|)) (HTTP/1\\.[01])$" * Option : "^([-a-zA-Z]+): (.+)$" @@ -715,12 +713,24 @@ int http_request_parse(server *srv, connection *con) { switch(*cur) { case '\r': if (con->parse_request->ptr[i+1] == '\n') { + data_string *ds = NULL; + /* End of Headerline */ con->parse_request->ptr[i] = '\0'; con->parse_request->ptr[i+1] = '\0'; if (in_folding) { - if (!ds) { + buffer *key_b; + /** + * we use a evil hack to handle the line-folding + * + * As array_insert_unique() deletes 'ds' in the case of a duplicate + * ds points somewhere and we get a evil crash. As a solution we keep the old + * "key" and get the current value from the hash and append us + * + * */ + + if (!key || !key_len) { /* 400 */ if (srv->srvconf.log_request_header_on_error) { @@ -737,7 +747,15 @@ int http_request_parse(server *srv, connection *con) { con->response.keep_alive = 0; return 0; } - buffer_append_string(ds->value, value); + + key_b = buffer_init(); + buffer_copy_string_len(key_b, key, key_len); + + if (NULL != (ds = (data_string *)array_get_element(con->request.headers, key_b->ptr))) { + buffer_append_string(ds->value, value); + } + + buffer_free(key_b); } else { int s_len; key = con->parse_request->ptr + first; @@ -969,7 +987,12 @@ int http_request_parse(server *srv, connection *con) { first = i+1; is_key = 1; value = 0; - key_len = 0; +#if 0 + /** + * for Bug 1230 keep the key_len a live + */ + key_len = 0; +#endif in_folding = 0; } else { if (srv->srvconf.log_request_header_on_error) { |