Hang when server returns 401 and closes connection
Brought to you by:
mavey
Some IIS servers on our intranet are return an http response 401, then closing the connection. According to the comments in direct.c, this behaviour shouldn't happen; unfortunately, it is.
318 if (loop == 1 && data[1]->code == 401 && hlist_subcmp_all(data[1]->headers, "WWW-Authenticate", "NTLM")) { 319 /* 320 * Server closing the connection after 401? 321 * Should never happen. 322 */
Cntlm then closes and re-opens the socket. From there is calls a series of functions, as follows:
www_authenticate http_body_drop data_send
The data_send funtion executes the following:
334 i = read(src, buf, block);
This call hangs, eventually timing out which causes the connection to fail. I think what's happening is that there isn't any data on the newly opened socket, so the read call blocks.
This is happening on Mac OS X 10.11. I haven't tried in under different versions of OS X or on Linux.
Cntlm version is 0.92.3.