MCPcopy Create free account
hub / github.com/SIPp/sipp / get_last_header

Method get_last_header

src/call.cpp:1540–1563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1538}
1539
1540char * 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. */

Callers

nothing calls this directly

Calls 2

ERRORFunction · 0.85
get_headerFunction · 0.85

Tested by

no test coverage detected