Re: connection closed on first attempt to send to IIS WebDav server
On Mon, 2013-12-16 at 20:20 +, Boxer, Aaron wrote: > Hello, > I am using the sardine java WebDav client (which uses HTTPClient) to send > files using WebDav protocol to an IIS 7.5 server. > Authentication is Basic. > > I always get the connection closed with a socket connection on my *first* put > to the server; any subsequent puts are fine. > > Below is a debug trace for sending two files. > > Thanks! > Aaron > Looks really like a server side issue. Can you tell me what version of HttpClient is being used? Oleg > > > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection request: [route: {}->http://scaramouche:80][total kept alive: 0; > route allocated: 0 of 2; total allocated: 0 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection leased: [id: 2][route: {}->http://scaramouche:80][total kept > alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] DefaultClientConnectionOperator - > Connecting to scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAddCookies - CookieSpec selected: > best-match > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAuthCache - Auth cache not set in > the context > 2013/12/16 15:20:11:972 EST [DEBUG] RequestTargetAuthentication - Target auth > state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] RequestProxyAuthentication - Proxy auth > state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultHttpClient - Attempt 1 to execute > request > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultClientConnection - Sending > request: PUT /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> PUT > /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Expect: 100-continue > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Content-Type: ISO-8859-1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Transfer-Encoding: chunked > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Host: scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Connection: Keep-Alive > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> User-Agent: > Sardine/UNAVAILABLE > 2013/12/16 15:20:11:974 EST [DEBUG] DefaultClientConnection - Receiving > response: HTTP/1.1 401 Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << HTTP/1.1 401 Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Cache-Control: private > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Content-Type: text/html; > charset=utf-8 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Server: Microsoft-IIS/7.5 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << WWW-Authenticate: Basic > realm="scaramouche" > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << X-Powered-By: ASP.NET > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Date: Mon, 16 Dec 2013 > 20:20:11 GMT > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Content-Length: 6321 > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - Connection can be > kept alive indefinitely > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - Authentication > required > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - scaramouche:80 > requested authentication > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - > Authentication schemes in the order of preference: [negotiate, Kerberos, > NTLM, Digest, Basic] > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - Challenge > for negotiate authentication scheme not available > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - Challenge > for Kerberos authentication scheme not available > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - Challenge > for NTLM authentication scheme not available > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - Challenge > for Digest authentication scheme not available > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - Selected > authentication options: [BASIC] > 2013/12/16 15:20:11:975 EST [DEBUG] RequestAddCookies - CookieSpec selected: > best-match > 2013/12/16 15:20:11:975 EST [DEBUG] RequestAuthCache - Auth cache not set in > the context > 2013/12/16 15:20:11:975 EST [DEBUG] RequestTargetAuthentication - Target auth > state: CHALLENGED > 2013/12/16 15:20:11:975 EST [DEBUG] RequestTargetAuthentication - Generating > response to an authentication challenge using basic scheme > 2013/12/16 15:20:11:976 EST [DEBUG] RequestProxyAuthentication - Proxy auth > state: UNCHALLENGED > 2013/12/16 15:20:11:976 EST [DEBUG] DefaultHttpClient - Attempt 2 to execute > request > 2013/12/16 15:20:11:976 EST [DEBUG] DefaultClientConnection - Sending > request: PUT /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:976 EST [DEBUG]
RE: connection closed on first attempt to send to IIS WebDav server
Hi Oleg, . -Original Message- From: Oleg Kalnichevski [mailto:ol...@apache.org] Sent: Monday, December 16, 2013 5:01 PM To: HttpClient User Discussion Subject: Re: connection closed on first attempt to send to IIS WebDav server On Mon, 2013-12-16 at 20:20 +, Boxer, Aaron wrote: > Hello, > I am using the sardine java WebDav client (which uses HTTPClient) to send > files using WebDav protocol to an IIS 7.5 server. > Authentication is Basic. > > I always get the connection closed with a socket connection on my *first* put > to the server; any subsequent puts are fine. > > Below is a debug trace for sending two files. > > Thanks! > Aaron > Looks really like a server side issue. Can you tell me what version of HttpClient is being used? Thanks, I am using the latest version of httpclient - 4.3.2-SNAPSHOT By the way, below are the logs from the web server; it seems that the first two requests (with 401.2 responses) don't have a user name in the request. #Software: Microsoft Internet Information Services 7.5 #Version: 1.0 #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken 2013-12-16 20:12:48 10.7.11.181 HEAD /upload - 80 - 10.7.11.181 - 401 2 5 82 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 - 10.7.11.181 Sardine/UNAVAILABLE 401 2 5 0 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 jdmi 10.7.11.181 Sardine/UNAVAILABLE 201 0 0 177 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.2 - 80 jdmi 10.7.11.181 Sardine/UNAVAILABLE 201 0 0 67 > > > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection request: [route: {}->http://scaramouche:80][total kept alive: 0; > route allocated: 0 of 2; total allocated: 0 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection leased: [id: 2][route: {}->http://scaramouche:80][total kept > alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] DefaultClientConnectionOperator - > Connecting to scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAddCookies - CookieSpec selected: > best-match > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAuthCache - Auth cache not set in > the context > 2013/12/16 15:20:11:972 EST [DEBUG] RequestTargetAuthentication - Target auth > state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] RequestProxyAuthentication - Proxy auth > state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultHttpClient - Attempt 1 to execute > request > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultClientConnection - Sending > request: PUT /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> PUT > /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Expect: 100-continue > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Content-Type: ISO-8859-1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Transfer-Encoding: chunked > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Host: scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Connection: Keep-Alive > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> User-Agent: > Sardine/UNAVAILABLE > 2013/12/16 15:20:11:974 EST [DEBUG] DefaultClientConnection - Receiving > response: HTTP/1.1 401 Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << HTTP/1.1 401 Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Cache-Control: private > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Content-Type: text/html; > charset=utf-8 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Server: Microsoft-IIS/7.5 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << WWW-Authenticate: Basic > realm="scaramouche" > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << X-Powered-By: ASP.NET > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Date: Mon, 16 Dec 2013 > 20:20:11 GMT > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Content-Length: 6321 > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - Connection can be > kept alive indefinitely > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - Authentication > required > 2013/12/16 15:20:11:975 EST [DEBUG] DefaultHttpClient - scaramouche:80 > requested authentication > 2013/12/16 15:20:11:975 EST [DEBUG] TargetAuthenticationStrategy - > Authentication schemes in the order of
RE: connection closed on first attempt to send to IIS WebDav server
Oleg, I managed to make the error go away by using "pre-emptive authentication" on the client: " When enabling preemptive authentication using Sardine.enablePreemptiveAuthentication(String host), sending an authentication header before any challenge received by the server." Thanks so much for your help, Aaron -Original Message- From: Boxer, Aaron Sent: Monday, December 16, 2013 10:26 PM To: HttpClient User Discussion Subject: RE: connection closed on first attempt to send to IIS WebDav server Hi Oleg, . -Original Message- From: Oleg Kalnichevski [mailto:ol...@apache.org] Sent: Monday, December 16, 2013 5:01 PM To: HttpClient User Discussion Subject: Re: connection closed on first attempt to send to IIS WebDav server On Mon, 2013-12-16 at 20:20 +, Boxer, Aaron wrote: > Hello, > I am using the sardine java WebDav client (which uses HTTPClient) to send > files using WebDav protocol to an IIS 7.5 server. > Authentication is Basic. > > I always get the connection closed with a socket connection on my *first* put > to the server; any subsequent puts are fine. > > Below is a debug trace for sending two files. > > Thanks! > Aaron > Looks really like a server side issue. Can you tell me what version of HttpClient is being used? Thanks, I am using the latest version of httpclient - 4.3.2-SNAPSHOT By the way, below are the logs from the web server; it seems that the first two requests (with 401.2 responses) don't have a user name in the request. #Software: Microsoft Internet Information Services 7.5 #Version: 1.0 #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken 2013-12-16 20:12:48 10.7.11.181 HEAD /upload - 80 - 10.7.11.181 - 401 2 5 82 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 - 10.7.11.181 Sardine/UNAVAILABLE 401 2 5 0 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 jdmi 10.7.11.181 Sardine/UNAVAILABLE 201 0 0 177 2013-12-16 20:12:54 10.7.11.181 PUT /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.2 - 80 jdmi 10.7.11.181 Sardine/UNAVAILABLE 201 0 0 67 > // > // > > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection request: [route: {}->http://scaramouche:80][total kept > alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > Connection leased: [id: 2][route: {}->http://scaramouche:80][total > kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] > 2013/12/16 15:20:11:971 EST [DEBUG] DefaultClientConnectionOperator - > Connecting to scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAddCookies - CookieSpec > selected: best-match > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAuthCache - Auth cache not > set in the context > 2013/12/16 15:20:11:972 EST [DEBUG] RequestTargetAuthentication - > Target auth state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] RequestProxyAuthentication - Proxy > auth state: UNCHALLENGED > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultHttpClient - Attempt 1 to > execute request > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultClientConnection - Sending > request: PUT /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> PUT > /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Expect: 100-continue > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Content-Type: > ISO-8859-1 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Transfer-Encoding: > chunked > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Host: scaramouche:80 > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Connection: > Keep-Alive > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> User-Agent: > Sardine/UNAVAILABLE > 2013/12/16 15:20:11:974 EST [DEBUG] DefaultClientConnection - > Receiving response: HTTP/1.1 401 Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << HTTP/1.1 401 > Unauthorized > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Cache-Control: > private > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Content-Type: > text/html; charset=utf-8 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << Server: > Microsoft-IIS/7.5 > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << WWW-Authenticate: Basic > realm="scaramouche" > 2013/12/16 15:20:11:975 EST [DEBUG] headers - << X-Powered-By: ASP.NET > 2013/12/16 15
Re: connection closed on first attempt to send to IIS WebDav server
On Tue, 2013-12-17 at 03:41 +, Boxer, Aaron wrote: > Oleg, > > I managed to make the error go away by using "pre-emptive authentication" on > the client: > > " When enabling preemptive authentication using > Sardine.enablePreemptiveAuthentication(String host), sending an > authentication header before any challenge received by the server." > > Thanks so much for your help, > Aaron > Aaron I still think the culprit is Microsoft-IIS/7.5. It rejects the first request as unauthenticated, which is fine, but it also closes the connection without properly informing the client (by sending a HTTP/1.1 message without 'Connection: close' header). Preemptive authentication helps work the problem around. Oleg > > > -Original Message- > From: Boxer, Aaron > Sent: Monday, December 16, 2013 10:26 PM > To: HttpClient User Discussion > Subject: RE: connection closed on first attempt to send to IIS WebDav server > > Hi Oleg, > . > > -Original Message- > From: Oleg Kalnichevski [mailto:ol...@apache.org] > Sent: Monday, December 16, 2013 5:01 PM > To: HttpClient User Discussion > Subject: Re: connection closed on first attempt to send to IIS WebDav server > > On Mon, 2013-12-16 at 20:20 +, Boxer, Aaron wrote: > > Hello, > > I am using the sardine java WebDav client (which uses HTTPClient) to send > > files using WebDav protocol to an IIS 7.5 server. > > Authentication is Basic. > > > > I always get the connection closed with a socket connection on my *first* > > put to the server; any subsequent puts are fine. > > > > Below is a debug trace for sending two files. > > > > Thanks! > > Aaron > > > > Looks really like a server side issue. > > Can you tell me what version of HttpClient is being used? > > > Thanks, I am using the latest version of httpclient - 4.3.2-SNAPSHOT > > By the way, below are the logs from the web server; it seems that the first > two requests (with 401.2 responses) don't have a user name in the request. > > #Software: Microsoft Internet Information Services 7.5 > #Version: 1.0 > #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username > c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken > 2013-12-16 20:12:48 10.7.11.181 HEAD /upload - 80 - 10.7.11.181 - 401 2 5 82 > 2013-12-16 20:12:54 10.7.11.181 PUT > /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 - 10.7.11.181 > Sardine/UNAVAILABLE 401 2 5 0 > 2013-12-16 20:12:54 10.7.11.181 PUT > /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.1 - 80 jdmi 10.7.11.181 > Sardine/UNAVAILABLE 201 0 0 177 > 2013-12-16 20:12:54 10.7.11.181 PUT > /upload/c3fb63f7-330d-49d2-af15-ff199ce65fd1.2 - 80 jdmi 10.7.11.181 > Sardine/UNAVAILABLE 201 0 0 67 > > > > > > // > > // > > > > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > > Connection request: [route: {}->http://scaramouche:80][total kept > > alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] > > 2013/12/16 15:20:11:971 EST [DEBUG] PoolingClientConnectionManager - > > Connection leased: [id: 2][route: {}->http://scaramouche:80][total > > kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] > > 2013/12/16 15:20:11:971 EST [DEBUG] DefaultClientConnectionOperator - > > Connecting to scaramouche:80 > > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAddCookies - CookieSpec > > selected: best-match > > 2013/12/16 15:20:11:972 EST [DEBUG] RequestAuthCache - Auth cache not > > set in the context > > 2013/12/16 15:20:11:972 EST [DEBUG] RequestTargetAuthentication - > > Target auth state: UNCHALLENGED > > 2013/12/16 15:20:11:972 EST [DEBUG] RequestProxyAuthentication - Proxy > > auth state: UNCHALLENGED > > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultHttpClient - Attempt 1 to > > execute request > > 2013/12/16 15:20:11:972 EST [DEBUG] DefaultClientConnection - Sending > > request: PUT /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> PUT > > /upload/0ab3aedd-5efe-428c-a791-f8e38885c874.1 HTTP/1.1 > > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Expect: 100-continue > > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Content-Type: > > ISO-8859-1 > > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Transfer-Encoding: > > chunked > > 2013/12/16 15:20:11:972 EST [DEBUG] headers - >> Host: scaramouche:80 > &
RE: connection closed on first attempt to send to IIS WebDav server
From: Oleg Kalnichevski [ol...@apache.org] Sent: Tuesday, December 17, 2013 3:27 AM To: HttpClient User Discussion Subject: Re: connection closed on first attempt to send to IIS WebDav server On Tue, 2013-12-17 at 03:41 +, Boxer, Aaron wrote: > Oleg, > > I managed to make the error go away by using "pre-emptive authentication" on > the client: > > " When enabling preemptive authentication using > Sardine.enablePreemptiveAuthentication(String host), sending an > authentication header before any challenge received by the server." > > Thanks so much for your help, > Aaron > Aaron I still think the culprit is Microsoft-IIS/7.5. It rejects the first request as unauthenticated, which is fine, but it also closes the connection without properly informing the client (by sending a HTTP/1.1 message without 'Connection: close' header). Preemptive authentication helps work the problem around. Yes, I think you're right. Sadly, IT insists on using IIS, so I am stuck with this behaviour. The workaround doesn't add too much overhead, so I guess I will use it. Thanks again, Aaron This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org