@@ -69,47 +69,6 @@ extern HttpBodyFactory *body_factory;
6969
7070static const char local_host_ip_str[] = " 127.0.0.1" ;
7171
72-
73- // someday, reduce the amount of duplicate code between this
74- // function and _process_xxx_connection_field_in_outgoing_header
75- inline static HTTPKeepAlive
76- is_header_keep_alive (const HTTPVersion & http_version, const HTTPVersion & request_http_version, MIMEField* con_hdr /* , bool* unknown_tokens */ )
77- {
78- enum
79- {
80- CON_TOKEN_NONE = 0 ,
81- CON_TOKEN_KEEP_ALIVE,
82- CON_TOKEN_CLOSE
83- };
84-
85- int con_token = CON_TOKEN_NONE;
86- HTTPKeepAlive keep_alive = HTTP_NO_KEEPALIVE;
87- // *unknown_tokens = false;
88-
89- if (con_hdr) {
90- if (con_hdr->value_get_index (" keep-alive" , 10 ) >= 0 )
91- con_token = CON_TOKEN_KEEP_ALIVE;
92- else if (con_hdr->value_get_index (" close" , 5 ) >= 0 )
93- con_token = CON_TOKEN_CLOSE;
94- }
95-
96- if (HTTPVersion (1 , 0 ) == http_version) {
97- keep_alive = (con_token == CON_TOKEN_KEEP_ALIVE) ? (HTTP_KEEPALIVE) : (HTTP_NO_KEEPALIVE);
98- } else if (HTTPVersion (1 , 1 ) == http_version) {
99- // We deviate from the spec here. If the we got a response where
100- // where there is no Connection header and the request 1.0 was
101- // 1.0 don't treat this as keep-alive since Netscape-Enterprise/3.6 SP1
102- // server doesn't
103- keep_alive = ((con_token == CON_TOKEN_KEEP_ALIVE) ||
104- (con_token == CON_TOKEN_NONE && HTTPVersion (1 , 1 ) == request_http_version)) ? (HTTP_KEEPALIVE)
105- : (HTTP_NO_KEEPALIVE);
106- } else {
107- keep_alive = HTTP_NO_KEEPALIVE;
108- }
109-
110- return (keep_alive);
111- }
112-
11372inline static bool
11473is_request_conditional (HTTPHdr* header)
11574{
@@ -5468,14 +5427,7 @@ HttpTransact::initialize_state_variables_from_request(State* s, HTTPHdr* obsolet
54685427 if (!s->txn_conf ->keep_alive_enabled_in ) {
54695428 s->client_info .keep_alive = HTTP_NO_KEEPALIVE;
54705429 } else {
5471- // If there is a Proxy-Connection header use that, otherwise use the Connection header
5472- if (pc != NULL ) {
5473- s->client_info .keep_alive = is_header_keep_alive (s->client_info .http_version , s->client_info .http_version , pc);
5474- } else {
5475- MIMEField *c = incoming_request->field_find (MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
5476-
5477- s->client_info .keep_alive = is_header_keep_alive (s->client_info .http_version , s->client_info .http_version , c);
5478- }
5430+ s->client_info .keep_alive = incoming_request->keep_alive_get ();
54795431 }
54805432
54815433 if (s->client_info .keep_alive == HTTP_KEEPALIVE && s->client_info .http_version == HTTPVersion (1 , 1 )) {
@@ -5582,23 +5534,7 @@ HttpTransact::initialize_state_variables_from_response(State* s, HTTPHdr* incomi
55825534 * if we sent "Connection: close" We need check the response
55835535 * header regardless of what we sent to the server
55845536 */
5585- MIMEField *c_hdr;
5586- if ((s->current .request_to != ORIGIN_SERVER) &&
5587- (s->current .request_to == PARENT_PROXY ||
5588- s->current .request_to == ICP_SUGGESTED_HOST)) {
5589- c_hdr = s->hdr_info .server_response .field_find (MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION);
5590-
5591- // If there is a Proxy-Connection header use that,
5592- // otherwise use the Connection header
5593- if (c_hdr == NULL ) {
5594- c_hdr = s->hdr_info .server_response .field_find (MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
5595- }
5596- } else {
5597- c_hdr = s->hdr_info .server_response .field_find (MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
5598- }
5599-
5600- s->current .server ->keep_alive = is_header_keep_alive (s->hdr_info .server_response .version_get (),
5601- s->hdr_info .server_request .version_get (), c_hdr);
5537+ s->current .server ->keep_alive = s->hdr_info .server_response .keep_alive_get ();
56025538
56035539 // Don't allow an upgrade request to Keep Alive
56045540 if (s->is_upgrade_request ) {
0 commit comments