View | Details | Raw Unified
Collapse All | Expand All

(-) src/request.c (-5 / +28 lines)
 Lines 284-291    Link Here 
	int done = 0;
	int done = 0;
	data_string *ds = NULL;
	/*
	/*
	 * Request: "^(GET|POST|HEAD) ([^ ]+(\\?[^ ]+|)) (HTTP/1\\.[01])$"
	 * Request: "^(GET|POST|HEAD) ([^ ]+(\\?[^ ]+|)) (HTTP/1\\.[01])$"
	 * Option : "^([-a-zA-Z]+): (.+)$"
	 * Option : "^([-a-zA-Z]+): (.+)$"
 Lines 715-726    Link Here 
			switch(*cur) {
			switch(*cur) {
			case '\r':
			case '\r':
				if (con->parse_request->ptr[i+1] == '\n') {
				if (con->parse_request->ptr[i+1] == '\n') {
					data_string *ds = NULL;
					/* End of Headerline */
					/* End of Headerline */
					con->parse_request->ptr[i] = '\0';
					con->parse_request->ptr[i] = '\0';
					con->parse_request->ptr[i+1] = '\0';
					con->parse_request->ptr[i+1] = '\0';
					if (in_folding) {
					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 */
							/* 400 */
							if (srv->srvconf.log_request_header_on_error) {
							if (srv->srvconf.log_request_header_on_error) {
 Lines 737-743    Link Here 
							con->response.keep_alive = 0;
							con->response.keep_alive = 0;
							return 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 {
					} else {
						int s_len;
						int s_len;
						key = con->parse_request->ptr + first;
						key = con->parse_request->ptr + first;
 Lines 969-975    Link Here 
					first = i+1;
					first = i+1;
					is_key = 1;
					is_key = 1;
					value = 0;
					value = 0;
					key_len = 0;
#if 0
					/**
					 * for Bug 1230 keep the key_len a live
					 */
					key_len = 0; 
#endif
					in_folding = 0;
					in_folding = 0;
				} else {
				} else {
					if (srv->srvconf.log_request_header_on_error) {
					if (srv->srvconf.log_request_header_on_error) {
(-) tests/core-request.t (-1 / +33 lines)
 Lines 8-14    Link Here 
use strict;
use strict;
use IO::Socket;
use IO::Socket;
use Test::More tests => 33;
use Test::More tests => 36;
use LightyTest;
use LightyTest;
my $tf = LightyTest->new();
my $tf = LightyTest->new();
 Lines 273-278    Link Here 
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'uppercase filenames');
ok($tf->handle_http($t) == 0, 'uppercase filenames');
$t->{REQUEST}  = ( <<EOF
GET / HTTP/1.0
Location: foo
Location: foobar
  baz
EOF
 );
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping');
$t->{REQUEST}  = ( <<EOF
GET / HTTP/1.0
Location: 
Location: foobar
  baz
EOF
 );
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping - test 2');
$t->{REQUEST}  = ( <<EOF
GET / HTTP/1.0
A: 
Location: foobar
  baz
EOF
 );
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping - test 3');
ok($tf->stop_proc == 0, "Stopping lighttpd");
ok($tf->stop_proc == 0, "Stopping lighttpd");