dgaudet 97/07/20 11:52:44
Modified: src CHANGES http_protocol.c http_request.c mod_browser.c Log: "force-response-1.0" now only applies to requests which are HTTP/1.0 to begin with. "nokeepalive" now works for HTTP/1.1 clients. Added "downgrade-1.0" which causes Apache to pretend it received a 1.0. mod_browser now triggers during translate_name to workaround a deficiency in the header_parse phase. PR: 875 Reviewed by: Roy Fielding Revision Changes Path 1.355 +5 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.354 retrieving revision 1.355 diff -C3 -r1.354 -r1.355 *** CHANGES 1997/07/20 13:17:58 1.354 --- CHANGES 1997/07/20 18:52:39 1.355 *************** *** 1,5 **** --- 1,10 ---- Changes with Apache 1.3 + *) "force-response-1.0" now only applies to requests which are HTTP/1.0 to + begin with. "nokeepalive" now works for HTTP/1.1 clients. Added + "downgrade-1.0" which causes Apache to pretend it received a 1.0. + [Dean Gaudet] related PR#875 + *) API: Correct child_init() slot declaration from int to void, to match the init() declaration. Update mod_example to use the new hook. [Ken Coar] 1.144 +9 -6 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.143 retrieving revision 1.144 diff -C3 -r1.143 -r1.144 *** http_protocol.c 1997/07/19 20:27:52 1.143 --- http_protocol.c 1997/07/20 18:52:40 1.144 *************** *** 281,288 **** * and the response status does not require a close; * and the response generator has not already indicated close; * and the client did not request non-persistence (Connection: close); * and the client is requesting an HTTP/1.0-style keep-alive - * and we haven't been configured to ignore the buggy twit, * or the client claims to be HTTP/1.1 compliant (perhaps a proxy); * THEN we can be persistent, which requires more headers be output. * --- 281,289 ---- * and the response status does not require a close; * and the response generator has not already indicated close; * and the client did not request non-persistence (Connection: close); + * and we haven't been configured to ignore the buggy twit + * or they're a buggy twit coming through a HTTP/1.1 proxy * and the client is requesting an HTTP/1.0-style keep-alive * or the client claims to be HTTP/1.1 compliant (perhaps a proxy); * THEN we can be persistent, which requires more headers be output. * *************** *** 304,312 **** !status_drops_connection(r->status) && !wimpy && !find_token(r->pool, conn, "close") && ! (((ka_sent = find_token(r->pool, conn, "keep-alive")) && ! !table_get(r->subprocess_env, "nokeepalive")) || ! (r->proto_num >= 1001)) ) { char header[256]; int left = r->server->keep_alive_max - r->connection->keepalives; --- 305,314 ---- !status_drops_connection(r->status) && !wimpy && !find_token(r->pool, conn, "close") && ! (!table_get(r->subprocess_env, "nokeepalive") || ! table_get(r->headers_in, "Via")) && ! ((ka_sent = find_token(r->pool, conn, "keep-alive")) || ! (r->proto_num >= 1001)) ) { char header[256]; int left = r->server->keep_alive_max - r->connection->keepalives; *************** *** 1048,1055 **** if (!r->status_line) r->status_line = status_lines[index_of_response(r->status)]; ! ! if (table_get(r->subprocess_env,"force-response-1.0")) protocol = "HTTP/1.0"; else protocol = SERVER_PROTOCOL; --- 1050,1058 ---- if (!r->status_line) r->status_line = status_lines[index_of_response(r->status)]; ! ! if (r->proto_num == 1000 ! && table_get(r->subprocess_env,"force-response-1.0")) protocol = "HTTP/1.0"; else protocol = SERVER_PROTOCOL; 1.66 +4 -0 apache/src/http_request.c Index: http_request.c =================================================================== RCS file: /export/home/cvs/apache/src/http_request.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C3 -r1.65 -r1.66 *** http_request.c 1997/07/19 20:27:53 1.65 --- http_request.c 1997/07/20 18:52:41 1.66 *************** *** 957,962 **** --- 957,966 ---- return; } + if (r->proto_num > 1000 && table_get (r->subprocess_env, "downgrade-1.0")) { + r->proto_num = 1000; + } + /* NB: directory_walk() clears the per_dir_config, so we don't inherit from location_walk() above */ 1.12 +4 -4 apache/src/mod_browser.c Index: mod_browser.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_browser.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C3 -r1.11 -r1.12 *** mod_browser.c 1997/07/17 22:27:34 1.11 --- mod_browser.c 1997/07/20 18:52:41 1.12 *************** *** 139,145 **** { NULL }, }; ! int parse_headers_browser_module(request_rec *r) { server_rec *s = r->server; browser_server_config_rec *sconf = get_module_config (s->module_config, --- 139,145 ---- { NULL }, }; ! static int browser_match(request_rec *r) { server_rec *s = r->server; browser_server_config_rec *sconf = get_module_config (s->module_config, *************** *** 166,172 **** } } ! return OK; } module MODULE_VAR_EXPORT browser_module = { --- 166,172 ---- } } ! return DECLINED; } module MODULE_VAR_EXPORT browser_module = { *************** *** 178,190 **** merge_browser_config, /* merge server configs */ browser_module_cmds, /* command table */ NULL, /* handlers */ ! NULL, /* filename translation */ NULL, /* check_user_id */ NULL, /* check auth */ NULL, /* check access */ NULL, /* type_checker */ NULL, /* fixups */ NULL, /* logger */ ! parse_headers_browser_module,/* header parser */ NULL /* child_init */ }; --- 178,190 ---- merge_browser_config, /* merge server configs */ browser_module_cmds, /* command table */ NULL, /* handlers */ ! browser_match, /* filename translation */ NULL, /* check_user_id */ NULL, /* check auth */ NULL, /* check access */ NULL, /* type_checker */ NULL, /* fixups */ NULL, /* logger */ ! NULL /* header parser */ NULL /* child_init */ };