[trafficserver] branch master updated: TS-5088: Fix missing initial buffer from server, when combined with 101 response
This is an automated email from the ASF dual-hosted git repository. scw00 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 28d80e5 TS-5088: Fix missing initial buffer from server, when combined with 101 response 28d80e5 is described below commit 28d80e52eca27b55cf7d5c89612afa5a3d25952f Author: Mervyn McMurray AuthorDate: Tue Jul 25 13:30:19 2017 +0100 TS-5088: Fix missing initial buffer from server, when combined with 101 response --- proxy/http/HttpSM.cc | 13 +++-- proxy/http/HttpSM.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 9c784e8..195d794 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1587,8 +1587,12 @@ HttpSM::handle_api_return() if (unlikely(t_state.did_upgrade_succeed)) { // We've successfully handled the upgrade, let's now setup // a blind tunnel. + IOBufferReader *initial_data = nullptr; if (t_state.is_websocket) { HTTP_INCREMENT_DYN_STAT(http_websocket_current_active_client_connections_stat); +if (server_session) { + initial_data = server_session->get_reader(); +} if (ua_session) { DebugSM("http_websocket", @@ -1607,7 +1611,7 @@ HttpSM::handle_api_return() } } - setup_blind_tunnel(true); + setup_blind_tunnel(true, initial_data); } else { HttpTunnelProducer *p = setup_server_transfer(); perform_cache_write_action(); @@ -6569,7 +6573,7 @@ HttpSM::setup_push_transfer_to_cache() } void -HttpSM::setup_blind_tunnel(bool send_response_hdr) +HttpSM::setup_blind_tunnel(bool send_response_hdr, IOBufferReader *initial) { HttpTunnelConsumer *c_ua; HttpTunnelConsumer *c_os; @@ -6583,6 +6587,11 @@ HttpSM::setup_blind_tunnel(bool send_response_hdr) milestones[TS_MILESTONE_SERVER_BEGIN_WRITE] = Thread::get_hrtime(); if (send_response_hdr) { client_response_hdr_bytes = write_response_header_into_buffer(&t_state.hdr_info.client_response, to_ua_buf); +if (initial && initial->read_avail()) { + int64_t avail = initial->read_avail(); + to_ua_buf->write(initial, avail); + initial->consume(avail); +} } else { client_response_hdr_bytes = 0; } diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index d4c6839..6c4e332 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -466,7 +466,7 @@ protected: void perform_cache_write_action(); void perform_transform_cache_write_action(); void perform_nca_cache_action(); - void setup_blind_tunnel(bool send_response_hdr); + void setup_blind_tunnel(bool send_response_hdr, IOBufferReader *initial = nullptr); HttpTunnelProducer *setup_server_transfer_to_transform(); HttpTunnelProducer *setup_transfer_from_transform(); HttpTunnelProducer *setup_cache_transfer_to_transform(); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" '].
[trafficserver] branch master updated: cachekey: ability to base the key on pristine URI.
This is an automated email from the ASF dual-hosted git repository. gancho pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 3ad5bf5 cachekey: ability to base the key on pristine URI. 3ad5bf5 is described below commit 3ad5bf5fcc5e99e7493befff59dd8a6e18df107c Author: Gancho Tenev AuthorDate: Thu Oct 19 13:31:39 2017 -0700 cachekey: ability to base the key on pristine URI. Added ability to base the cache key on the pristine URI rather then on the URI set during remap. New option added (see plugin doc): --uri-type=[remap|pristine] (default:remap) In addition changed the CacheKey constructor to use in-class member initialization. --- doc/admin-guide/plugins/cachekey.en.rst | 7 +++ plugins/experimental/cachekey/configs.cc | 28 plugins/experimental/cachekey/configs.h | 24 plugins/experimental/cachekey/plugin.cc | 26 +- 4 files changed, 80 insertions(+), 5 deletions(-) diff --git a/doc/admin-guide/plugins/cachekey.en.rst b/doc/admin-guide/plugins/cachekey.en.rst index b36e6ee..bc126ca 100644 --- a/doc/admin-guide/plugins/cachekey.en.rst +++ b/doc/admin-guide/plugins/cachekey.en.rst @@ -39,6 +39,13 @@ This plugin allows some common cache key manipulations based on various HTTP req * capture and replace strings from the URI and include them in the cache key * do more - please find more examples below. +URI type + + +The plugin manipulates the ``remap`` URI (value set during URI remap) by default. If manipulation needs to be based on the ``pristine`` URI (the value before URI remapping takes place) one could use the following option: + +* ``--uri-type=[remap|pristine]`` (default: ``remap``) + Cache key structure and related plugin parameters = diff --git a/plugins/experimental/cachekey/configs.cc b/plugins/experimental/cachekey/configs.cc index 788b56d..80f2e54 100644 --- a/plugins/experimental/cachekey/configs.cc +++ b/plugins/experimental/cachekey/configs.cc @@ -344,6 +344,7 @@ Configs::init(int argc, char *argv[]) {const_cast("remove-prefix"), optional_argument, nullptr, 'q'}, {const_cast("remove-path"), optional_argument, nullptr, 'r'}, {const_cast("separator"), optional_argument, nullptr, 's'}, +{const_cast("uri-type"), optional_argument, nullptr, 't'}, {nullptr, 0, nullptr, 0}, }; @@ -442,6 +443,9 @@ Configs::init(int argc, char *argv[]) case 's': /* separator */ setSeparator(optarg); break; +case 't': /* uri-type */ + setUriType(optarg); + break; } } @@ -486,3 +490,27 @@ Configs::getSeparator() { return _separator; } + +void +Configs::setUriType(const char *arg) +{ + if (nullptr != arg) { +if (5 == strlen(arg) && 0 == strncasecmp(arg, "remap", 5)) { + _uriType = CacheKeyUriType::REMAP; + CacheKeyDebug("using remap URI type"); +} else if (8 == strlen(arg) && 0 == strncasecmp(arg, "pristine", 8)) { + _uriType = CacheKeyUriType::PRISTINE; + CacheKeyDebug("using pristine URI type"); +} else { + CacheKeyError("unrecognized URI type '%s', using default 'remap'", arg); +} + } else { +CacheKeyError("found an empty URI type, using default 'remap'"); + } +} + +CacheKeyUriType +Configs::getUriType() +{ + return _uriType; +} diff --git a/plugins/experimental/cachekey/configs.h b/plugins/experimental/cachekey/configs.h index 9bf71cb..9ae29f9 100644 --- a/plugins/experimental/cachekey/configs.h +++ b/plugins/experimental/cachekey/configs.h @@ -27,6 +27,11 @@ #include "pattern.h" #include "common.h" +enum CacheKeyUriType { + REMAP, + PRISTINE, +}; + /** * @brief Plug-in configuration elements (query / headers / cookies). * @@ -122,7 +127,7 @@ private: class Configs { public: - Configs() : _prefixToBeRemoved(false), _pathToBeRemoved(false), _separator("/") {} + Configs() {} /** * @brief initializes plugin configuration. * @param argc number of plugin parameters @@ -157,6 +162,16 @@ public: */ const String &getSeparator(); + /** + * @brief sets the URI Type. + */ + void setUriType(const char *arg); + + /** + * @brief get URI type. + */ + CacheKeyUriType getUriType(); + /* Make the following members public to avoid unnecessary accessors */ ConfigQuery _query;/**< @brief query parameter related configuration */ ConfigHeaders _headers;/**< @brief headers related configuration */ @@ -178,9 +193,10 @@ private: */ bool loadClassifiers(const String &args, bool blacklist = true); - bool _prefixToBeRemoved; /**< @brief instructs the prefix (i.e. host:port) not to added to the cache key */ - bool _pathToBeRemoved; /**< @brief instructs the path not to added to the cache key */ - String _separat
[trafficserver] branch master updated: add string_view hash operator
This is an automated email from the ASF dual-hosted git repository. dragon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 0cfa80e add string_view hash operator 0cfa80e is described below commit 0cfa80e3f884a460d010dd64a4eaee588ed784b9 Author: Jason Kenny AuthorDate: Thu Oct 19 14:20:40 2017 -0500 add string_view hash operator clang-format --- lib/ts/string_view.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/lib/ts/string_view.h b/lib/ts/string_view.h index b68e56d..89e3ff6 100644 --- a/lib/ts/string_view.h +++ b/lib/ts/string_view.h @@ -1212,6 +1212,19 @@ using string_view = basic_string_view; } // namespace ts +namespace std +{ +template struct hash> { + using string_type = ts::basic_string_view<_Type, _Traits>; + + size_t + operator()(string_type const &x) const + { +return hash()(x.data()); + } +}; +} + /// Literal suffix for string_view. /// @note This enables @c string_view literals from C++ string literals in @c constexpr contexts, which /// is not the case for the character pointer constructor. @@ -1221,6 +1234,7 @@ constexpr ts::string_view operator"" _sv(const char *str, size_t len) noexcept return ts::string_view(str, len); } +// // TS local extensions, not dependent on our local implementation of std::string_view. /// Check for prefix. -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" '].
[trafficserver] branch 7.1.x updated: optimze: move http 408 response logic into transaction
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/7.1.x by this push: new d27be95 optimze: move http 408 response logic into transaction d27be95 is described below commit d27be954e4c11e11974316af35e8842b9b98c828 Author: scw00 AuthorDate: Wed Oct 11 10:45:15 2017 +0800 optimze: move http 408 response logic into transaction (cherry picked from commit be3571fa70b81d722a99977a3f5997e031432753) Conflicts: proxy/http/HttpSM.cc --- proxy/http/HttpSM.cc | 81 --- proxy/http/HttpTransact.cc| 20 + proxy/http/HttpTransact.h | 2 + tests/gold_tests/headers/http408.gold | 3 +- 4 files changed, 43 insertions(+), 63 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 97fbdfa..1f2f986 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -84,9 +84,6 @@ static const int boundary_size = 2 + sizeof("RANGE_SEPARATOR") - 1 + 2; static const char *str_100_continue_response = "HTTP/1.1 100 Continue\r\n\r\n"; static const int len_100_continue_response = strlen(str_100_continue_response); -static const char *str_408_request_timeout_response = "HTTP/1.1 408 Request Timeout\r\nConnection: close\r\n\r\n"; -static const int len_408_request_timeout_response = strlen(str_408_request_timeout_response); - namespace { /// Update the milestone state given the milestones and timer. @@ -2786,6 +2783,19 @@ HttpSM::tunnel_handler_post(int event, void *data) switch (event) { case HTTP_TUNNEL_EVENT_DONE: // Tunnel done. +if (p->handler_state == HTTP_SM_POST_UA_FAIL && client_response_hdr_bytes == 0) { + // post failed + switch (t_state.client_info.state) { + case HttpTransact::ACTIVE_TIMEOUT: + call_transact_and_set_next_state(HttpTransact::PostActiveTimeoutResponse); +return 0; + case HttpTransact::INACTIVE_TIMEOUT: + call_transact_and_set_next_state(HttpTransact::PostInactiveTimeoutResponse); +return 0; + default: +break; + } +} break; case VC_EVENT_WRITE_READY: // iocore may callback first before send. return 0; @@ -2799,18 +2809,6 @@ HttpSM::tunnel_handler_post(int event, void *data) ua_entry->write_buffer = nullptr; ua_entry->vc->do_io_write(this, 0, nullptr); } -// The if statement will always true since these codes are all for HTTP 408 response sending. - by oknet xu -if (p->handler_state == HTTP_SM_POST_UA_FAIL) { - Debug("http_tunnel", "cleanup tunnel in tunnel_handler_post"); - hsm_release_assert(ua_entry->in_tunnel == true); - tunnel_handler_post_or_put(p); - vc_table.cleanup_all(); - tunnel.chain_abort_all(p); - p->read_vio = nullptr; - p->vc->do_io_close(EHTTP_ERROR); - tunnel.kill_tunnel(); - return 0; -} break; case VC_EVENT_READ_READY: case VC_EVENT_READ_COMPLETE: @@ -3515,8 +3513,6 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p) { STATE_ENTER(&HttpSM::tunnel_handler_post_ua, event); client_request_body_bytes = p->init_bytes_done + p->bytes_read; - int64_t nbytes, buf_size; - IOBufferReader *buf_start; switch (event) { case VC_EVENT_INACTIVITY_TIMEOUT: @@ -3525,56 +3521,17 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p) p->handler_state = HTTP_SM_POST_UA_FAIL; set_ua_abort(HttpTransact::ABORTED, event); - switch (event) { - case VC_EVENT_INACTIVITY_TIMEOUT: -HttpTransact::build_error_response(&t_state, HTTP_STATUS_REQUEST_TIMEOUT, "POST Request timeout", "timeout#inactivity", - nullptr); -break; - case VC_EVENT_ACTIVE_TIMEOUT: -HttpTransact::build_error_response(&t_state, HTTP_STATUS_REQUEST_TIMEOUT, "POST Request timeout", "timeout#activity", - nullptr); -break; - } - - // send back 408 request timeout - buf_size = index_to_buffer_size(HTTP_HEADER_BUFFER_SIZE_INDEX) + t_state.internal_msg_buffer_size; - if (ua_entry->write_buffer) { -if (t_state.hdr_info.client_request.m_100_continue_required) { - ink_assert(ua_entry->write_vio && !ua_entry->write_vio->ntodo()); -} -free_MIOBuffer(ua_entry->write_buffer); -ua_entry->write_buffer = nullptr; - } - ua_entry->write_buffer = new_MIOBuffer(buffer_size_to_index(buf_size)); - buf_start = ua_entry->write_buffer->alloc_reader(); - DebugSM("http_tunnel", "send 408 response to client to vc %p, tunnel vc %p", ua_session->get_netvc(), p->vc); - if (t_state.internal_msg_buffer && t_state.internal_msg_buffer_size) { -client_response_hdr_bytes = writ
[trafficserver] branch quic-latest updated (22a9c65 -> 91294bf)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 22a9c65 Change to use string_view, which is needed after merging current master add c6abe37 coverity 1021743: Uninitialized members add bc33954 Skip Link Local address to mitigate slow getnameinfo(3) problem on macOS new 91294bf Merge branch 'master' into quic-latest The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: iocore/net/P_UnixNet.h | 2 +- iocore/utils/Machine.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" '].
[trafficserver] 01/01: Merge branch 'master' into quic-latest
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 91294bf2cbdfe1bdd01f9daa8e01c8b061bc1389 Merge: 22a9c65 bc33954 Author: Leif Hedstrom AuthorDate: Fri Oct 20 08:36:28 2017 -0600 Merge branch 'master' into quic-latest * master: Skip Link Local address to mitigate slow getnameinfo(3) problem on macOS coverity 1021743: Uninitialized members iocore/net/P_UnixNet.h | 2 +- iocore/utils/Machine.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" .