MCPcopy Create free account
hub / github.com/apache/trafficserver / cacheNodeList

Function cacheNodeList

plugins/esi/esi.cc:591–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589}
590
591static void
592cacheNodeList(ContData *cont_data)
593{
594 bool client_abort;
595 if (TSHttpTxnAborted(cont_data->txnp, &client_abort) == TS_SUCCESS) {
596 CONT_DATA_DBG(cont_data, "[%s] Not caching node list as txn has been aborted", __FUNCTION__);
597 return;
598 }
599 string post_request("");
600 post_request.append(TS_HTTP_METHOD_POST);
601 post_request.append(" ");
602 post_request.append(cont_data->request_url);
603 post_request.append(" HTTP/1.0\r\n");
604 post_request.append(SERVER_INTERCEPT_HEADER);
605 post_request.append(": cache=1\r\n");
606 for (list<string>::iterator list_iter = cont_data->post_headers.begin(); list_iter != cont_data->post_headers.end();
607 ++list_iter) {
608 post_request.append(ECHO_HEADER_PREFIX);
609
610 if (((int)list_iter->length() > HEADER_MASK_PREFIX_SIZE) &&
611 (strncmp(list_iter->c_str(), HEADER_MASK_PREFIX, HEADER_MASK_PREFIX_SIZE) == 0)) {
612 post_request.append(list_iter->c_str() + HEADER_MASK_PREFIX_SIZE, list_iter->length() - HEADER_MASK_PREFIX_SIZE);
613 } else {
614 post_request.append(*list_iter);
615 }
616 }
617 post_request.append(TS_MIME_FIELD_ACCEPT_ENCODING, TS_MIME_LEN_ACCEPT_ENCODING);
618 post_request.append(": ");
619 post_request.append(TS_HTTP_VALUE_GZIP, TS_HTTP_LEN_GZIP);
620 post_request.append("\r\n");
621
622 string body("");
623 cont_data->esi_proc->packNodeList(body, false);
624 char buf[64];
625 snprintf(buf, 64, "%s: %d\r\n\r\n", TS_MIME_FIELD_CONTENT_LENGTH, static_cast<int>(body.size()));
626
627 post_request.append(buf);
628 post_request.append(body);
629
630 TSFetchEvent event_ids = {0, 0, 0};
631 TSFetchUrl(post_request.data(), post_request.size(), cont_data->client_addr, cont_data->contp, NO_CALLBACK, event_ids);
632}
633
634static int
635transformData(TSCont contp)

Callers 1

transformDataFunction · 0.85

Calls 10

TSHttpTxnAbortedFunction · 0.85
TSFetchUrlFunction · 0.85
packNodeListMethod · 0.80
appendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected