I have configured ATS as a web proxy in a NTLM authentication domain; and, have
a plugin with a function for TS_HTTP_READ_REQUEST_HDR_HOOK say, func_1.
In func_1 which is invoked during the request header, I create a hook for
TS_HTTP_SEND_RESPONSE_HDR_HOOK (say, func_2) and then do a
TSHttpTxnReenable(txnp, TS_EVENT_HTTP_ERROR);
Subsequently, when func_2 is invoked during the SEND_RESPONSE_HEADER event, I
frame a “407 Proxy Auth required” response header along with Proxy-Authenticate
set to “NTLM” and then do a TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
Func_1() {
….
…
TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_RESPONSE_HDR_HOOK,
TSContCreate(responseHook, TS_NULL_MUTEX));
}
TSHttpTxnReenable(txnp, TS_EVENT_HTTP_ERROR);
….
return;
}
func_2() {
…
TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
return;
}
What happens is that even though the client sends a “Connection: keep-alive”,
ATS seems to be returning a “Connection: close” which results in the connection
getting closed.
> GET http://www.purple.com/ HTTP/1.1
> Host: www.purple.com
> Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
> User-Agent: curl/7.44.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 407 Proxy Authentication Required
< Date: Sun, 03 Sep 2017 10:47:24 GMT
< Connection: close
< Via: http/1.1 POD128-CentOS7-01 (ApacheTrafficServer/6.2.1)
< Server: ATS/6.2.1
< Proxy-Authenticate: NTLM
< Content-Length: 15
< Content-Type: text/plain
<
0 15 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
* Closing connection 7
Why is ATS closing the connection?And, how can I control this behavior?
Thanks,
Ananth