2
0
Fork 0

fix segfault when no host header in request

personal/stbuehler/wip
Thomas Porzelt 2008-11-10 02:16:02 +01:00
parent 64e823f83a
commit abb7bc1067
1 changed files with 8 additions and 6 deletions

View File

@ -105,11 +105,13 @@ gboolean request_validate_header(connection *con) {
/* get hostname */
l = http_header_find_first(req->headers, CONST_STR_LEN("host"));
if (NULL != l && NULL != http_header_find_next(l, CONST_STR_LEN("host"))) {
/* more than one "host" header */
bad_request(con, 400); /* bad request */
return FALSE;
} else {
if (NULL != l) {
if (NULL != http_header_find_next(l, CONST_STR_LEN("host"))) {
/* more than one "host" header */
bad_request(con, 400); /* bad request */
return FALSE;
}
hh = (http_header*) l->data;
g_string_append_len(req->uri.authority, HEADER_VALUE_LEN(hh));
if (!parse_hostname(&req->uri)) {
@ -145,7 +147,7 @@ gboolean request_validate_header(connection *con) {
}
/**
* negative content-length is not supported
* negative content-length is not supported
* and is a bad request
*/
if (r < 0) {