Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2385 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.21
Stefan Bühler 15 years ago
parent fdcb6f60f4
commit cb91487c8d

@ -31,6 +31,7 @@ NEWS
* Disable SSLv2 by default
* Use/enforce sane max-connection values (fixes #1803)
* Allow mod_compress to return 304 (Not Modified); compress ignores the static-file.etags option.(fixes #1884)
* Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
- 1.4.20 - 2008-09-30

@ -497,6 +497,7 @@ typedef struct {
#endif
} stat_cache_engine;
unsigned short enable_cores;
unsigned short reject_expect_100_with_417;
} server_config;
typedef struct {

@ -94,6 +94,7 @@ static int config_insert(server *srv) {
{ "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
{ "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
{ "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
{ "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */
{ "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
{ "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
@ -135,6 +136,7 @@ static int config_insert(server *srv) {
cv[43].destination = &(srv->srvconf.max_conns);
cv[12].destination = &(srv->srvconf.max_request_size);
cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
assert(srv->config_storage);

@ -894,11 +894,12 @@ int http_request_parse(server *srv, connection *con) {
*
*/
con->http_status = 417;
con->keep_alive = 0;
array_insert_unique(con->request.headers, (data_unset *)ds);
return 0;
if (srv->srvconf.reject_expect_100_with_417 && 0 == buffer_caseless_compare(CONST_BUF_LEN(ds->value), CONST_STR_LEN("100-continue"))) {
con->http_status = 417;
con->keep_alive = 0;
array_insert_unique(con->request.headers, (data_unset *)ds);
return 0;
}
} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Host")))) {
if (!con->request.http_host) {
con->request.http_host = ds->value;

@ -210,6 +210,7 @@ static server *server_init(void) {
srv->srvconf.modules_dir = buffer_init_string(LIBRARY_DIR);
srv->srvconf.network_backend = buffer_init();
srv->srvconf.upload_tempdirs = array_init();
srv->srvconf.reject_expect_100_with_417 = 1;
/* use syslog */
srv->errorlog_fd = -1;

Loading…
Cancel
Save