Transform the client request into a HEAD request and write it out.
| 282 | |
| 283 | // Transform the client request into a HEAD request and write it out. |
| 284 | static bool |
| 285 | AuthWriteHeadRequest(AuthRequestContext *auth) |
| 286 | { |
| 287 | HttpHeader rq; |
| 288 | TSMBuffer mbuf; |
| 289 | TSMLoc mhdr; |
| 290 | |
| 291 | TSReleaseAssert(TSHttpTxnClientReqGet(auth->txn, &mbuf, &mhdr) == TS_SUCCESS); |
| 292 | |
| 293 | // First, copy the whole client request to our new auth proxy request. |
| 294 | TSReleaseAssert(TSHttpHdrCopy(rq.buffer, rq.header, mbuf, mhdr) == TS_SUCCESS); |
| 295 | |
| 296 | // Next, we need to rewrite the client request URL to be a HEAD request. |
| 297 | TSReleaseAssert(TSHttpHdrMethodSet(rq.buffer, rq.header, TS_HTTP_METHOD_HEAD, -1) == TS_SUCCESS); |
| 298 | |
| 299 | HttpSetMimeHeader(rq.buffer, rq.header, TS_MIME_FIELD_CONTENT_LENGTH, 0u); |
| 300 | HttpSetMimeHeader(rq.buffer, rq.header, TS_MIME_FIELD_CACHE_CONTROL, "no-cache"); |
| 301 | |
| 302 | HttpDebugHeader(rq.buffer, rq.header); |
| 303 | |
| 304 | // Serialize the HTTP request to the write IO buffer. |
| 305 | TSHttpHdrPrint(rq.buffer, rq.header, auth->iobuf.buffer); |
| 306 | |
| 307 | // We have to tell the auth context not to try to ready the response |
| 308 | // body (since HEAD can have a content-length but must not have any |
| 309 | // content). |
| 310 | auth->read_body = false; |
| 311 | |
| 312 | TSHandleMLocRelease(mbuf, TS_NULL_MLOC, mhdr); |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | // Transform the client request into a GET Range: bytes=0-0 request. This is useful |
| 317 | // for example of the authentication service is a caching proxy which might not |
nothing calls this directly
no test coverage detected