| 1538 | } |
| 1539 | |
| 1540 | char * call::get_last_header(const char * name) |
| 1541 | { |
| 1542 | int len; |
| 1543 | |
| 1544 | if((!last_recv_msg) || (!strlen(last_recv_msg))) { |
| 1545 | return nullptr; |
| 1546 | } |
| 1547 | |
| 1548 | len = strlen(name); |
| 1549 | |
| 1550 | /* Ideally this check should be moved to the XML parser so that it is not |
| 1551 | * along a critical path. We could also handle lowercasing there. */ |
| 1552 | if (len > MAX_HEADER_LEN) { |
| 1553 | ERROR("call::get_last_header: Header to parse bigger than %d (%zu)", MAX_HEADER_LEN, strlen(name)); |
| 1554 | } |
| 1555 | |
| 1556 | if (name[len - 1] == ':') { |
| 1557 | return get_header(last_recv_msg, name, false); |
| 1558 | } else { |
| 1559 | char with_colon[MAX_HEADER_LEN+2]; |
| 1560 | snprintf(with_colon, MAX_HEADER_LEN+2, "%s:", name); |
| 1561 | return get_header(last_recv_msg, with_colon, false); |
| 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | /* Return the last request URI from the To header. On any error returns the |
| 1566 | * empty string. The caller must free the result. */ |
nothing calls this directly
no test coverage detected