Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions proxy/ProxySession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,15 @@ ProxySession::support_sni() const
{
return _vc ? _vc->support_sni() : false;
}

HostDBApplicationInfo::HttpVersion
ProxySession::get_version(HTTPHdr &hdr) const
{
if (hdr.version_get() == HTTPVersion(1, 1)) {
return HostDBApplicationInfo::HTTP_VERSION_11;
} else if (hdr.version_get() == HTTPVersion(1, 0)) {
return HostDBApplicationInfo::HTTP_VERSION_10;
} else {
return HostDBApplicationInfo::HTTP_VERSION_09;
}
}
2 changes: 2 additions & 0 deletions proxy/ProxySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
virtual int populate_protocol(std::string_view *result, int size) const;
virtual const char *protocol_contains(std::string_view tag_prefix) const;

virtual HostDBApplicationInfo::HttpVersion get_version(HTTPHdr &hdr) const;

// Non-Virtual Methods
NetVConnection *get_netvc() const;
int do_api_callout(TSHttpHookID id);
Expand Down
6 changes: 6 additions & 0 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8322,3 +8322,9 @@ HttpSM::get_server_session() const
{
return server_session;
}

HostDBApplicationInfo::HttpVersion
HttpSM::get_server_version(HTTPHdr &hdr) const
{
return this->server_session->get_version(hdr);
}
2 changes: 2 additions & 0 deletions proxy/http/HttpSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ class HttpSM : public Continuation, public PluginUserArgs<TS_USER_ARGS_TXN>
// the current active server session
PoolableSession *get_server_session() const;

HostDBApplicationInfo::HttpVersion get_server_version(HTTPHdr &hdr) const;

ProxyTransaction *
get_ua_txn()
{
Expand Down
40 changes: 7 additions & 33 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3982,47 +3982,21 @@ HttpTransact::handle_forward_server_connection_open(State *s)
TxnDebug("http_seq", "[HttpTransact::handle_server_connection_open] ");
ink_release_assert(s->current.state == CONNECTION_ALIVE);

if (s->hdr_info.server_response.version_get() == HTTPVersion(0, 9)) {
TxnDebug("http_trans", "[hfsco] server sent 0.9 response, reading...");
build_response(s, &s->hdr_info.client_response, s->client_info.http_version, HTTP_STATUS_OK, "Connection Established");

s->client_info.keep_alive = HTTP_NO_KEEPALIVE;
s->cache_info.action = CACHE_DO_NO_ACTION;
s->next_action = SM_ACTION_SERVER_READ;
return;

} else if (s->hdr_info.server_response.version_get() == HTTPVersion(1, 0)) {
if (s->current.server->http_version == HTTPVersion(0, 9)) {
// update_hostdb_to_indicate_server_version_is_1_0
s->updated_server_version = HostDBApplicationInfo::HTTP_VERSION_10;
} else if (s->current.server->http_version == HTTPVersion(1, 1)) {
// update_hostdb_to_indicate_server_version_is_1_0
s->updated_server_version = HostDBApplicationInfo::HTTP_VERSION_10;
} else {
// dont update the hostdb. let us try again with what we currently think.
}
} else if (s->hdr_info.server_response.version_get() == HTTPVersion(1, 1)) {
if (s->current.server->http_version == HTTPVersion(0, 9)) {
// update_hostdb_to_indicate_server_version_is_1_1
s->updated_server_version = HostDBApplicationInfo::HTTP_VERSION_11;
} else if (s->current.server->http_version == HTTPVersion(1, 0)) {
// update_hostdb_to_indicate_server_version_is_1_1
s->updated_server_version = HostDBApplicationInfo::HTTP_VERSION_11;
} else {
// dont update the hostdb. let us try again with what we currently think.
}
} else {
// dont update the hostdb. let us try again with what we currently think.
HostDBApplicationInfo::HttpVersion real_version = s->state_machine->get_server_version(s->hdr_info.server_response);
if (real_version != s->host_db_info.app.http_data.http_version) {
TxnDebug("http_trans", "Update hostdb history of server HTTP version 0x%x", real_version);
// Need to update the hostdb
s->updated_server_version = real_version;
}

s->state_machine->do_hostdb_update_if_necessary();

if (s->hdr_info.server_response.status_get() == HTTP_STATUS_CONTINUE ||
s->hdr_info.server_response.status_get() == HTTP_STATUS_EARLY_HINTS) {
handle_100_continue_response(s);
return;
}

s->state_machine->do_hostdb_update_if_necessary();

if (s->www_auth_content == CACHE_AUTH_FRESH) {
// no update is needed - either to serve from cache if authorized,
// or tunnnel the server response
Expand Down