Browse Source

improve readability for error in request header error (fix #101)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@379 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.3.14
Jan Kneschke 17 years ago
parent
commit
533e8047c0
  1. 19
      src/request.c

19
src/request.c

@ -450,12 +450,25 @@ int http_request_parse(server *srv, connection *con) {
/* check uri for invalid characters */
for (j = 0; j < con->request.uri->used - 1; j++) {
if (!request_uri_is_valid_char(con->request.uri->ptr[j])) {
unsigned char buf[2];
con->http_status = 400;
con->keep_alive = 0;
log_error_write(srv, __FILE__, __LINE__, "sd",
"invalid character in URI -> 400",
con->request.uri->ptr[j]);
buf[0] = con->request.uri->ptr[j];
buf[1] = '\0';
if (con->request.uri->ptr[j] > 32 &&
con->request.uri->ptr[j] != 127) {
/* the character is printable -> print it */
log_error_write(srv, __FILE__, __LINE__, "ss",
"invalid character in URI -> 400",
buf);
} else {
/* a control-character, print ascii-code */
log_error_write(srv, __FILE__, __LINE__, "sd",
"invalid character in URI -> 400",
con->request.uri->ptr[j]);
}
if (srv->srvconf.log_request_header_on_error) {
log_error_write(srv, __FILE__, __LINE__, "Sb",

Loading…
Cancel
Save