| 652 | } |
| 653 | |
| 654 | char * |
| 655 | url_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 | -------------------------------------------------------------------------*/ |
no test coverage detected