* @brief get the pristin URL path * * @param txnp HTTP transaction structure * @return pristine URL path */
| 299 | * @return pristine URL path |
| 300 | */ |
| 301 | static String |
| 302 | getPristineUrlPath(TSHttpTxn txnp) |
| 303 | { |
| 304 | String pristinePath; |
| 305 | TSMLoc pristineUrlLoc; |
| 306 | TSMBuffer reqBuffer; |
| 307 | |
| 308 | if (TS_SUCCESS == TSHttpTxnPristineUrlGet(txnp, &reqBuffer, &pristineUrlLoc)) { |
| 309 | int pathLen = 0; |
| 310 | const char *path = TSUrlPathGet(reqBuffer, pristineUrlLoc, &pathLen); |
| 311 | if (nullptr != path) { |
| 312 | PrefetchDebug("path: '%.*s'", pathLen, path); |
| 313 | pristinePath.assign(path, pathLen); |
| 314 | } else { |
| 315 | PrefetchError("failed to get pristine URL path"); |
| 316 | } |
| 317 | TSHandleMLocRelease(reqBuffer, TS_NULL_MLOC, pristineUrlLoc); |
| 318 | } else { |
| 319 | PrefetchError("failed to get pristine URL"); |
| 320 | } |
| 321 | return pristinePath; |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * @brief get the pristin URL querystring |
no test coverage detected