| 425 | } |
| 426 | |
| 427 | static TSEvent |
| 428 | StateAuthProxyCompleteHeaders(AuthRequestContext *auth, void * /* edata ATS_UNUSED */) |
| 429 | { |
| 430 | TSHttpStatus status; |
| 431 | |
| 432 | HttpDebugHeader(auth->rheader.buffer, auth->rheader.header); |
| 433 | |
| 434 | status = TSHttpHdrStatusGet(auth->rheader.buffer, auth->rheader.header); |
| 435 | AuthLogDebug("authorization proxy returned status %d", (int)status); |
| 436 | |
| 437 | // Authorize the original request on a 2xx response. |
| 438 | if (status >= 200 && status < 300) { |
| 439 | return TS_EVENT_IMMEDIATE; |
| 440 | } |
| 441 | |
| 442 | if (auth->read_body) { |
| 443 | // We can't support sending the auth proxy response back to the client |
| 444 | // without writing a transform. Since that's more trouble than I want to |
| 445 | // deal with right now, let's just fail fast ... |
| 446 | if (HttpIsChunkedEncoding(auth->rheader.buffer, auth->rheader.header)) { |
| 447 | AuthLogDebug("ignoring chunked authorization proxy response"); |
| 448 | } else { |
| 449 | // OK, we have a non-chunked response. If there's any content, let's go and |
| 450 | // buffer it so that we can send it on to the client. |
| 451 | unsigned nbytes = HttpGetContentLength(auth->rheader.buffer, auth->rheader.header); |
| 452 | if (nbytes > 0) { |
| 453 | AuthLogDebug("content length is %u", nbytes); |
| 454 | return TS_EVENT_HTTP_CONTINUE; |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | // We are going to reply with the auth proxy's response. The response body |
| 459 | // is empty in this case. |
| 460 | AuthChainAuthorizationResponse(auth); |
| 461 | return TS_EVENT_HTTP_SEND_RESPONSE_HDR; |
| 462 | } |
| 463 | |
| 464 | static TSEvent |
| 465 | StateAuthProxySendResponse(AuthRequestContext *auth, void * /* edata ATS_UNUSED */) |
nothing calls this directly
no test coverage detected