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

Function StateAuthProxyCompleteHeaders

plugins/authproxy/authproxy.cc:427–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427static TSEvent
428StateAuthProxyCompleteHeaders(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
464static TSEvent
465StateAuthProxySendResponse(AuthRequestContext *auth, void * /* edata ATS_UNUSED */)

Callers

nothing calls this directly

Calls 5

HttpDebugHeaderFunction · 0.85
TSHttpHdrStatusGetFunction · 0.85
HttpIsChunkedEncodingFunction · 0.85
HttpGetContentLengthFunction · 0.85

Tested by

no test coverage detected