| 589 | } |
| 590 | |
| 591 | static void |
| 592 | cacheNodeList(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 | |
| 634 | static int |
| 635 | transformData(TSCont contp) |
no test coverage detected