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

Function getRemapUrlStr

plugins/xdebug/xdebug.cc:369–395  ·  view source on GitHub ↗

The returned string must be freed with TSfree() unless it is equal to the constant NotFound.

Source from the content-addressed store, hash-verified

367// The returned string must be freed with TSfree() unless it is equal to the constant NotFound.
368//
369static const char *
370getRemapUrlStr(TSHttpTxn txnp, TSReturnCode (*remapUrlGetFunc)(TSHttpTxn, TSMLoc *), int &urlStrLen)
371{
372 TSMLoc urlLoc;
373
374 TSReturnCode rc = remapUrlGetFunc(txnp, &urlLoc);
375 if (rc != TS_SUCCESS) {
376 urlStrLen = sizeof(NotFound) - 1;
377 return NotFound;
378 }
379
380 char *urlStr = TSUrlStringGet(nullptr, urlLoc, &urlStrLen);
381
382 // Be defensive.
383 if ((urlStrLen == 0) and urlStr) {
384 TSError("[xdebug] non-null remap URL string with zero length");
385 TSfree(urlStr);
386 urlStr = nullptr;
387 }
388
389 if (!urlStr) {
390 urlStrLen = sizeof(NotFound) - 1;
391 return NotFound;
392 }
393
394 return urlStr;
395}
396
397static void
398InjectRemapHeader(TSHttpTxn txn, TSMBuffer buffer, TSMLoc hdr)

Callers 1

InjectRemapHeaderFunction · 0.85

Calls 3

TSUrlStringGetFunction · 0.85
TSfreeFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected