mmustafasenoglu commented on PR #13313: URL: https://github.com/apache/trafficserver/pull/13313#issuecomment-4819759067
Hi @JosiahWI and @jpeach, You are entirely correct that the `TSUrlHostGet` API itself can be called anytime as long as the provided TSMBuffer is properly populated with a host. However, the confusion usually stems from the transaction lifecycle in a reverse proxy setup. When a client sends a standard relative URI request (e.g., `GET /path HTTP/1.1`) accompanied by a `Host` header, the request URL in the marshal buffer (retrieved via `TSHttpTxnClientReqGet`) does not have the host portion populated initially. If a plugin author calls `TSUrlHostGet` on this request URL during an early hook like `TS_HTTP_READ_REQUEST_HDR_HOOK`, they will get an empty result. The URL's host is typically only populated after the remap phase is complete (`TS_HTTP_POST_REMAP_HOOK`). I can update the PR documentation to make this distinction clearer: that while the API operates on any valid buffer, extracting the host from a client request transaction may require waiting until post-remap if relying on the URL instead of the Host header. Let me know if you would like me to adjust the wording this way! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
