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

Function url_string_get

src/proxy/hdrs/URL.cc:654–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652}
653
654char *
655url_string_get(URLImpl *url, Arena *arena, int *length, HdrHeap *heap)
656{
657 int len = url_length_get(url);
658 char *buf;
659 char *buf2;
660 int index = 0;
661 int offset = 0;
662
663 buf = arena ? arena->str_alloc(len) : static_cast<char *>(ats_malloc(len + 1));
664
665 url_print(url, buf, len, &index, &offset);
666 buf[len] = '\0';
667
668 /* see string_get_ref() */
669 if (heap) {
670 buf2 = heap->allocate_str(len + 1);
671 memcpy(buf2, buf, len);
672 buf2[len] = '\0';
673 url->m_clean = true; // reset since we have url_print()'ed again
674 url->m_len_printed_string = len;
675 url->m_ptr_printed_string = buf2;
676 }
677
678 if (length) {
679 *length = len;
680 }
681 return buf;
682}
683
684/*-------------------------------------------------------------------------
685 -------------------------------------------------------------------------*/

Callers 3

TSUrlStringGetFunction · 0.85
TSUrlPercentEncodeFunction · 0.85
string_getMethod · 0.85

Calls 6

url_length_getFunction · 0.85
ats_mallocFunction · 0.85
url_printFunction · 0.85
str_allocMethod · 0.80
allocate_strMethod · 0.80
memcpyFunction · 0.50

Tested by

no test coverage detected