TS-3662 Fix build issue, and eliminate strdup
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c542d6e9 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c542d6e9 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c542d6e9 Branch: refs/heads/master Commit: c542d6e9e45569839fae67778fb44cd99a0f1d40 Parents: 8904069 Author: Leif Hedstrom <[email protected]> Authored: Tue Jun 9 08:35:18 2015 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Tue Jun 9 08:35:18 2015 -0600 ---------------------------------------------------------------------- .../cache_range_requests/cache_range_requests.cc | 9 +++------ proxy/http/HttpSM.cc | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c542d6e9/plugins/experimental/cache_range_requests/cache_range_requests.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/cache_range_requests/cache_range_requests.cc b/plugins/experimental/cache_range_requests/cache_range_requests.cc index 0967ff0..0bff2ec 100644 --- a/plugins/experimental/cache_range_requests/cache_range_requests.cc +++ b/plugins/experimental/cache_range_requests/cache_range_requests.cc @@ -164,7 +164,7 @@ static void handle_client_send_response(TSHttpTxn txnp) { bool partial_content_reason = false; - char *p, *reason; + char *p; int length; TSMBuffer response; TSMLoc resp_hdr; @@ -177,13 +177,11 @@ handle_client_send_response(TSHttpTxn txnp) TSHttpStatus status = TSHttpHdrStatusGet(response, resp_hdr); // a cached result will have a TS_HTTP_OK with a 'Partial Content' reason if ((p = (char *)TSHttpHdrReasonGet(response, resp_hdr, &length)) != NULL) { - reason = TSstrndup(p, length + 1); - reason[length] = '\0'; - if (strncasecmp(reason, "Partial Content", length) == 0) { + if ((length == 15) && (0 == strncasecmp(p, "Partial Content", length))) { partial_content_reason = true; } } - TSDebug(PLUGIN_NAME, "status %d %s", status, reason); + TSDebug(PLUGIN_NAME, "status %d %.*s", status, length, p); if (TS_HTTP_STATUS_OK == status && partial_content_reason) { TSDebug(PLUGIN_NAME, "handle_client_send_response (): Got TS_HTTP_STATUS_OK."); TSHttpHdrStatusSet(response, resp_hdr, TS_HTTP_STATUS_PARTIAL_CONTENT); @@ -191,7 +189,6 @@ handle_client_send_response(TSHttpTxn txnp) } } TSHandleMLocRelease(response, resp_hdr, NULL); - TSfree(reason); TSDebug(PLUGIN_NAME, "End of handle_client_send_response ()"); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c542d6e9/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 55c8c08..9a8b2b3 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3152,8 +3152,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) if (close_connection) { // If the client could be pipelining, we need to set the ua_session into half close mode - if (t_state.client_info.pipeline_possible == true && c->producer->vc_type != HT_STATIC && - event == VC_EVENT_WRITE_COMPLETE) { + if (t_state.client_info.pipeline_possible == true && c->producer->vc_type != HT_STATIC && event == VC_EVENT_WRITE_COMPLETE) { ua_session->set_half_close_flag(); }
