max-request-size was not respected since a long time

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@736 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Jan Kneschke 2005-09-26 08:49:13 +00:00
parent 2865e7d1c9
commit c440468249
3 changed files with 10 additions and 7 deletions

View File

@ -444,6 +444,7 @@ typedef struct {
unsigned short max_worker;
unsigned short max_fds;
unsigned short max_conns;
unsigned short max_request_size;
unsigned short log_request_header_on_error;
unsigned short log_state_handling;
@ -464,7 +465,6 @@ typedef struct {
buffer *ssl_ca_file;
unsigned short use_ipv6;
unsigned short is_ssl;
unsigned short max_request_size;
buffer *srv_token;

View File

@ -114,6 +114,7 @@ static int config_insert(server *srv) {
cv[41].destination = stat_cache_string;
cv[42].destination = &(srv->srvconf.max_conns);
cv[12].destination = &(srv->srvconf.max_request_size);
srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
assert(srv->config_storage);
@ -131,8 +132,8 @@ static int config_insert(server *srv) {
s->error_handler = buffer_init();
s->server_tag = buffer_init();
s->errorfile_prefix = buffer_init();
s->max_keep_alive_requests = 128;
s->max_keep_alive_idle = 30;
s->max_keep_alive_requests = 16;
s->max_keep_alive_idle = 5;
s->max_read_idle = 60;
s->max_write_idle = 360;
s->use_xattr = 0;
@ -153,7 +154,6 @@ static int config_insert(server *srv) {
cv[8].destination = &(s->use_ipv6);
cv[12].destination = &(s->max_request_size);
/* 13 max-worker */
cv[14].destination = s->document_root;
cv[15].destination = &(s->force_lower_case);

View File

@ -969,6 +969,7 @@ int http_request_parse(server *srv, connection *con) {
/* content-length is missing */
log_error_write(srv, __FILE__, __LINE__, "s",
"POST-request, but content-length missing -> 411");
con->keep_alive = 0;
con->http_status = 411;
return 0;
@ -977,20 +978,22 @@ int http_request_parse(server *srv, connection *con) {
/* don't handle more the SSIZE_MAX bytes in content-length */
if (con->request.content_length > SSIZE_MAX) {
con->http_status = 413;
con->keep_alive = 0;
log_error_write(srv, __FILE__, __LINE__, "sds",
"request-size too long:", con->request.content_length, "-> 413");
return 0;
}
/* divide by 1024 as srvconf.max_request_size is in kBytes */
if (srv_socket->max_request_size != 0 &&
(con->request.content_length >> 10) > srv_socket->max_request_size) {
if (srv->srvconf.max_request_size != 0 &&
(con->request.content_length >> 10) > srv->srvconf.max_request_size) {
/* the request body itself is larger then
* our our max_request_size
*/
con->http_status = 413;
con->keep_alive = 0;
log_error_write(srv, __FILE__, __LINE__, "sds",
"request-size too long:", con->request.content_length, "-> 413");