You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/07/01 00:00:25 UTC
trafficserver git commit: TS-3693: Move 100-continue logic to read
client header for intercept plugins
Repository: trafficserver
Updated Branches:
refs/heads/master e9eeab6be -> cc07927fc
TS-3693: Move 100-continue logic to read client header for intercept plugins
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/cc07927f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/cc07927f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/cc07927f
Branch: refs/heads/master
Commit: cc07927fc9780ed3999fc6b3809ac33c5b562e7a
Parents: e9eeab6
Author: Feifei Cai <ff...@yahoo-inc.com>
Authored: Tue Jun 30 14:51:07 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Tue Jun 30 14:59:47 2015 -0700
----------------------------------------------------------------------
proxy/http/HttpSM.cc | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc07927f/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index f9962f0..37b73d5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -707,6 +707,30 @@ HttpSM::state_read_client_request_header(int event, void *data)
ua_session->m_active = true;
HTTP_INCREMENT_DYN_STAT(http_current_active_client_connections_stat);
}
+
+ if (t_state.hdr_info.client_request.version_get() == HTTPVersion(1, 1) &&
+ (t_state.hdr_info.client_request.method_get_wksidx() == HTTP_WKSIDX_POST ||
+ t_state.hdr_info.client_request.method_get_wksidx() == HTTP_WKSIDX_PUT) &&
+ t_state.http_config_param->send_100_continue_response) {
+ int len = 0;
+ const char *expect = t_state.hdr_info.client_request.value_get(MIME_FIELD_EXPECT, MIME_LEN_EXPECT, &len);
+ // When receive an "Expect: 100-continue" request from client, ATS sends a "100 Continue" response to client
+ // imediately, before receive the real response from original server.
+ if ((len == HTTP_LEN_100_CONTINUE) && (strncasecmp(expect, HTTP_VALUE_100_CONTINUE, HTTP_LEN_100_CONTINUE) == 0)) {
+ int64_t alloc_index = buffer_size_to_index(len_100_continue_response);
+ if (ua_entry->write_buffer) {
+ free_MIOBuffer(ua_entry->write_buffer);
+ ua_entry->write_buffer = NULL;
+ }
+ ua_entry->write_buffer = new_MIOBuffer(alloc_index);
+ IOBufferReader *buf_start = ua_entry->write_buffer->alloc_reader();
+
+ DebugSM("http_seq", "send 100 Continue response to client");
+ int64_t nbytes = ua_entry->write_buffer->write(str_100_continue_response, len_100_continue_response);
+ ua_session->do_io_write(ua_session->get_netvc(), nbytes, buf_start);
+ }
+ }
+
if (t_state.hdr_info.client_request.method_get_wksidx() == HTTP_WKSIDX_TRACE ||
(t_state.hdr_info.request_content_length == 0 && t_state.client_info.transfer_encoding != HttpTransact::CHUNKED_ENCODING)) {
// Enable further IO to watch for client aborts
@@ -1847,25 +1871,6 @@ HttpSM::state_send_server_request_header(int event, void *data)
if (post_transform_info.vc) {
setup_transform_to_server_transfer();
} else {
- if (t_state.http_config_param->send_100_continue_response) {
- int len = 0;
- const char *expect = t_state.hdr_info.client_request.value_get(MIME_FIELD_EXPECT, MIME_LEN_EXPECT, &len);
- // When receive an "Expect: 100-continue" request from client, ATS sends a "100 Continue" response to client
- // imediately, before receive the real response from original server.
- if ((len == HTTP_LEN_100_CONTINUE) && (strncasecmp(expect, HTTP_VALUE_100_CONTINUE, HTTP_LEN_100_CONTINUE) == 0)) {
- int64_t alloc_index = buffer_size_to_index(len_100_continue_response);
- if (ua_entry->write_buffer) {
- free_MIOBuffer(ua_entry->write_buffer);
- ua_entry->write_buffer = NULL;
- }
- ua_entry->write_buffer = new_MIOBuffer(alloc_index);
- IOBufferReader *buf_start = ua_entry->write_buffer->alloc_reader();
-
- DebugSM("http_seq", "send 100 Continue response to client");
- int64_t nbytes = ua_entry->write_buffer->write(str_100_continue_response, len_100_continue_response);
- ua_session->do_io_write(ua_session->get_netvc(), nbytes, buf_start);
- }
- }
do_setup_post_tunnel(HTTP_SERVER_VC);
}
} else {