Ananth Laxminarasimhan (alaxmina)
2017-09-03 13:28:24 UTC
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.
< 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
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 RequiredHost: www.purple.com
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.44.0
Accept: */*
Proxy-Connection: Keep-Alive
< 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