Repository: trafficserver Updated Branches: refs/heads/master 27cd0674e -> 75d182c44
TS-4243: Added collapsed_forward to the parent makefile so it will get built. Also changed the allocation of the RequestData so the std::string member is appropriately initialized. This was causing a crash when running. And fixed a compile error I saw in RHEL 6 This close #508. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/75d182c4 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/75d182c4 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/75d182c4 Branch: refs/heads/master Commit: 75d182c4424b86eabdfbf7fd2c0affa28d91c5ac Parents: 27cd067 Author: shinrich <[email protected]> Authored: Tue Mar 1 16:35:38 2016 -0600 Committer: Alan M. Carroll <[email protected]> Committed: Tue Mar 1 19:32:25 2016 -0600 ---------------------------------------------------------------------- plugins/experimental/Makefile.am | 1 + .../collapsed_forwarding/collapsed_forwarding.cc | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/75d182c4/plugins/experimental/Makefile.am ---------------------------------------------------------------------- diff --git a/plugins/experimental/Makefile.am b/plugins/experimental/Makefile.am index c6bf978..1a98e39 100644 --- a/plugins/experimental/Makefile.am +++ b/plugins/experimental/Makefile.am @@ -23,6 +23,7 @@ SUBDIRS = \ cache_range_requests \ cache_promote \ collapsed_connection \ + collapsed_forwarding \ custom_redirect \ epic \ escalate \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/75d182c4/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc b/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc index bafe396..18861c7 100644 --- a/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc +++ b/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc @@ -192,7 +192,8 @@ on_send_response_header(RequestData *req, TSHttpTxn &txnp, TSCont &contp) TSHttpStatus status = TSHttpHdrStatusGet(bufp, hdr_loc); TSDebug(DEBUG_TAG, "Response code: %d", status); - if ((status == TS_HTTP_STATUS_BAD_GATEWAY) || (status == TS_HTTP_STATUS_SEE_OTHER)) { + if ((status == TS_HTTP_STATUS_BAD_GATEWAY) || (status == TS_HTTP_STATUS_SEE_OTHER) || + status == TS_HTTP_STATUS_INTERNAL_SERVER_ERROR) { bool is_internal_message_hdr = check_internal_message_hdr(txnp); bool delay_request = is_internal_message_hdr || ((req->wl_retry > 0) && (req->wl_retry < OPEN_WRITE_FAIL_MAX_REQ_DELAY_RETRIES)); @@ -213,7 +214,7 @@ on_send_response_header(RequestData *req, TSHttpTxn &txnp, TSCont &contp) } // done..cleanup - TSfree(req); + delete req; TSContDestroy(contp); TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc); @@ -239,8 +240,8 @@ collapsed_cont(TSCont contp, TSEvent event, void *edata) case TS_EVENT_HTTP_READ_RESPONSE_HDR: { return on_read_response_header(txnp); } - case TSEvent::TS_EVENT_IMMEDIATE: - case TSEvent::TS_EVENT_TIMEOUT: { + case TS_EVENT_IMMEDIATE: + case TS_EVENT_TIMEOUT: { return on_immediate(my_req, contp); } case TS_EVENT_HTTP_SEND_RESPONSE_HDR: { @@ -283,16 +284,14 @@ TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri) { TSCont cont = TSContCreate(collapsed_cont, TSMutexCreate()); - RequestData *req_data; - req_data = static_cast<RequestData *>(TSmalloc(sizeof(RequestData))); - memset(req_data, 0, sizeof(RequestData)); + RequestData *req_data = new RequestData(); req_data->txnp = rh; req_data->wl_retry = 0; int url_len = 0; char *url = TSHttpTxnEffectiveUrlStringGet(rh, &url_len); - req_data->req_url = std::string(url, url_len); + req_data->req_url.assign(url, url_len); TSfree(url); TSContDataSet(cont, req_data);
