[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901199#action_12901199
 ] 

Richard Bassous commented on HTTPCLIENT-951:
--------------------------------------------

Thanks Oleg:
It seems to be something with the SSL
I added the logs:

Here is a sample log from a working upload(I removed the host and IP):
It has a lot of debug here (I Think its the file content)
then.....
08-22 12:23:52.979: << "HTTP/1.1 200 OK[\r][\n]"
08-22 12:23:52.981: << "Date: Sun, 22 Aug 2010 16:25:20 GMT[\r][\n]"
08-22 12:23:52.991: << "Server: Microsoft-IIS/6.0[\r][\n]"
08-22 12:23:52.991: << "X-Powered-By: ASP.NET[\r][\n]"
08-22 12:23:52.991: << "X-AspNet-Version: 2.0.50727[\r][\n]"
08-22 12:23:53.001: << "Cache-Control: private[\r][\n]"
08-22 12:23:53.001: << "Content-Type: text/html; charset=utf-8[\r][\n]"
08-22 12:23:53.001: << "Content-Length: 484[\r][\n]"
08-22 12:23:53.001: << "[\r][\n]"
08-22 12:23:53.011: Receiving response: HTTP/1.1 200 OK
08-22 12:23:53.011: << HTTP/1.1 200 OK
08-22 12:23:53.011: << Date: Sun, 22 Aug 2010 16:25:20 GMT
08-22 12:23:53.011: << Server: Microsoft-IIS/6.0
08-22 12:23:53.011: << X-Powered-By: ASP.NET
08-22 12:23:53.011: << X-AspNet-Version: 2.0.50727
08-22 12:23:53.011: << Cache-Control: private
08-22 12:23:53.011: << Content-Type: text/html; charset=utf-8
08-22 12:23:53.011: << Content-Length: 484
08-22 12:23:53.021: Connection can be kept alive for ever
08-22 12:23:53.021: Shutting down
08-22 12:23:53.021: Connection closed
08-22 12:23:53.091: Get connection: HttpRoute[{s}->https://****.com], timeout = 
10000
08-22 12:23:53.091: [HttpRoute[{s}->https://****.com]] total kept alive: 0, 
total issued: 0, total allocated: 0 out of 20
08-22 12:23:53.091: No free connections [HttpRoute[{s}->https://****.com]][null]
08-22 12:23:53.091: Available capacity: 2 out of 2 
[HttpRoute[{s}->https://****.com]][null]
08-22 12:23:53.091: Creating new connection [HttpRoute[{s}->https://****.com]]
08-22 12:23:53.091: Connecting to ****.com/*.*.*.*:443
08-22 12:23:53.461: CookieSpec selected: best-match
08-22 12:23:53.461: Attempt 1 to execute request
08-22 12:23:53.501: Shutting down
08-22 12:23:53.501: Sending request: POST /UploadFiles.aspx HTTP/1.1
08-22 12:23:53.501: >> "POST /UploadFiles.aspx HTTP/1.1[\r][\n]"
08-22 12:23:53.501: >> "Cache-Control: no-cache[\r][\n]"
08-22 12:23:53.501: >> "Pragma: no-cache[\r][\n]"
08-22 12:23:53.501: >> "Authorization: Basic *****************[\r][\n]"
08-22 12:23:53.511: >> "ty: 0[\r][\n]"
08-22 12:23:53.511: >> "v: 252[\r][\n]"
08-22 12:23:53.511: >> "u: 354957030634904[\r][\n]"
08-22 12:23:53.511: >> "postType: 0[\r][\n]"
08-22 12:23:53.511: >> "filenum: -999[\r][\n]"
08-22 12:23:53.511: >> "pl: 1[\r][\n]"
08-22 12:23:53.511: >> "on: 1[\r][\n]"
08-22 12:23:53.521: >> "mf: 5[\r][\n]"
08-22 12:23:53.521: >> "Transfer-File-Name: **** [\r][\n]"
08-22 12:23:53.521: >> "Transfer-File-Chunk-Count: 1[\r][\n]"
08-22 12:23:53.521: >> "Transfer-File-Chunk: 0[\r][\n]"
08-22 12:23:53.521: >> "filelength: 5120[\r][\n]"
08-22 12:23:53.521: >> "Cookie: ASP.NET_SessionId=4eypxj45tsnabe45ficbnd55; 
path=/; HttpOnly[\r][\n]"
08-22 12:23:53.521: >> "Content-Length: 5120[\r][\n]"
08-22 12:23:53.521: >> "Content-Type: binary/octet-stream[\r][\n]"
08-22 12:23:53.521: >> "Host: ****.com[\r][\n]"
08-22 12:23:53.521: >> "Connection: Keep-Alive[\r][\n]"
08-22 12:23:53.531: >> "[\r][\n]"
08-22 12:23:53.531: >> POST /UploadFiles.aspx HTTP/1.1
08-22 12:23:53.531: >> Cache-Control: no-cache
08-22 12:23:53.531: >> Pragma: no-cache
08-22 12:23:53.531: >> Authorization: Basic  *****************
08-22 12:23:53.531: >> ty: 0
08-22 12:23:53.531: >> v: 252
08-22 12:23:53.531: >> u: 354957030634904
08-22 12:23:53.531: >> postType: 0
08-22 12:23:53.531: >> filenum: -999
08-22 12:23:53.531: >> pl: 1
08-22 12:23:53.531: >> on: 1
08-22 12:23:53.531: >> mf: 5
08-22 12:23:53.531: >> Transfer-File-Name: ****
08-22 12:23:53.531: >> Transfer-File-Chunk-Count: 1
08-22 12:23:53.531: >> Transfer-File-Chunk: 0
08-22 12:23:53.531: >> filelength: 5120
08-22 12:23:53.531: >> Cookie: ASP.NET_SessionId=4eypxj45tsnabe45ficbnd55; 
path=/; HttpOnly
08-22 12:23:53.531: >> Content-Length: 5120
08-22 12:23:53.531: >> Content-Type: binary/octet-stream
08-22 12:23:53.531: >> Host: ****.com
08-22 12:23:53.531: >> Connection: Keep-Alive



And here is the same log from a non working device:
It has a lot of debug here (I Think its the file content)
then.....
08-22 12:19:18.374 D: Connection closed
08-22 12:19:18.374 D: Closing the connection.
08-22 12:19:18.374 D: Connection closed
08-22 12:19:18.374 I: I/O exception (java.io.IOException) caught when 
processing request: SSL shutdown failed: I/O error during system call, Broken 
pipe
08-22 12:19:18.397 D: SSL shutdown failed: I/O error during system call, Broken 
pipe
08-22 12:19:18.397 D: java.io.IOException: SSL shutdown failed: I/O error 
during system call, Broken pipe
08-22 12:19:18.397 D:   at 
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeclose(Native 
Method)
08-22 12:19:18.397 D:   at 
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:958)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:259)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:162)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.conn.AbstractPooledConnAdapter.close(AbstractPooledConnAdapter.java:152)
08-22 12:19:18.397 D:   at 
org.apache41.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:129)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:623)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:453)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:700)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:625)
08-22 12:19:18.397 D:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:603)
08-22 12:19:18.397 D:   at hg.a(ProGuard:2446)
08-22 12:19:18.397 D:   at b.a(ProGuard:1962)
08-22 12:19:18.397 D:   at b.a(ProGuard:1563)
08-22 12:19:18.397 D:   at e.run(ProGuard:1509)
08-22 12:19:18.397 I: Retrying request
08-22 12:19:18.405 D: Reopening the direct connection.
08-22 12:19:18.405 D: Connecting to ****.com/*.*.*.*:443
08-22 12:19:20.288 D: Cannot retry non-repeatable request
08-22 12:19:20.296 D: Connection shut down
08-22 12:19:20.296 D: Released connection is not reusable.
08-22 12:19:20.296 D: Releasing connection 
[HttpRoute[{s}->https://****.com]][null]
08-22 12:19:20.296 D: Notifying no-one, there are no waiting threads
08-22 12:19:20.311 E: null
08-22 12:19:20.311 E: org.apache41.http.client.ClientProtocolException
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:702)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:625)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:603)
08-22 12:19:20.311 E:   at hg.a(ProGuard:2446)
08-22 12:19:20.311 E:   at b.a(ProGuard:1962)
08-22 12:19:20.311 E:   at b.a(ProGuard:1563)
08-22 12:19:20.311 E:   at e.run(ProGuard:1509)
08-22 12:19:20.311 E: Caused by: 
org.apache41.http.client.NonRepeatableRequestException: Cannot retry request 
with a non-repeatable request entity.  The cause lists the reason the original 
request failed.
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:610)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:453)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:700)
08-22 12:19:20.311 E:   ... 6 more
08-22 12:19:20.311 E: Caused by: java.io.IOException: SSL shutdown failed: I/O 
error during system call, Broken pipe
08-22 12:19:20.311 E:   at 
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeclose(Native 
Method)
08-22 12:19:20.311 E:   at 
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:958)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:259)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:162)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.conn.AbstractPooledConnAdapter.close(AbstractPooledConnAdapter.java:152)
08-22 12:19:20.311 E:   at 
org.apache41.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:129)
08-22 12:19:20.311 E:   at 
org.apache41.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:623)
08-22 12:19:20.311 E:   ... 8 more
08-22 12:19:20.319 D: Shutting down
08-22 12:19:22.507 D: Shutting down

> Incorrect handling of InputStreams when connecting to a server that requires 
> authentication
> -------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-951
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-951
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0 Final, 4.0.1, 4.1 Alpha1, 4.1 Alpha2
>         Environment: Windows XP, Java 1.6.20
>            Reporter: Thierry Guérin
>             Fix For: 4.0.2, 4.1 Alpha3
>
>         Attachments: httpClient.diff, httpClient4.0.x.diff, 
> httpClient4.1.diff, httpClientTrunk.diff, httpCore.diff, httpCoreTrunk.Diff, 
> testClientAuthentication.diff
>
>
> I'm trying to upload a file to a WebDav server (mod_dav on Apache Web Server 
> 2.2.14) that has basic (or digest, the result is the same) authentication 
> enabled.
> I'm using the following code:
>         String url = "http://myserver/dir/test2.gif";;
>         File file = new File("d:/test2.gif");
>         DefaultHttpClient httpClient = new DefaultHttpClient();
>         HttpPut put = new HttpPut(url);
>         put.setEntity(new InputStreamEntity(new FileInputStream(file), 
> file.length()));
>         
>         URI uri = put.getURI();
>         httpClient.getCredentialsProvider().setCredentials(new 
> AuthScope(uri.getHost(), uri.getPort()),
>                 getCredentials());
>         
> put.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, 
> true);
>         HttpResponse response = httpClient.execute(put);
>         System.out.println(response.getStatusLine());
> When running the above code, I'm getting a 
> org.apache.http.client.NonRepeatableRequestException: Cannot retry request 
> with a non-repeatable request entity. I tested both the latest alpha & the 
> svn head. Doing the same thing in HttpClient 3.1 worked as expected. 
> This could be normal, as I'm using an InputStream that is indeed not 
> repeatable, but as I'm also using Expect: 100-Continue, the stream shouldn't 
> have been consumed with the first connection (the one that gets a code 401 
> from the WebDav server), and only in the second one, when the credentials are 
> provided.
> The problem is that DefaultRequestDirector.execute doesn't take this into 
> account and assumes that if a request has been tried once, its associated 
> entity (if any) has been consumed.
> Here's the fix that I came up with:
> Change DefaultRequestDirector.execute so that if the wrapper is an 
> EntityEnclosingRequestWrapper, it checks if the entity has actually been 
> consumed before throwing a NonRepeatableRequestException. I'm using the 
> method isStreaming() from HttpEntity, as it's the closest thing to what I was 
> looking for. Reading the JavaDoc, it could lead to the situation where an 
> entity has started streaming but has not yet finished, and so is not in a 
> state where it can be used. However I don't think that's a problem as the 
> javadoc for HttpEntity.getContent() states that it can't be called two times 
> on a non-repeatable entity, so it's just a matter of when the request will 
> fail.
> This lead me to also modify InputStreamEntity (from the httpCore project) as 
> it didn't comply with the javadoc. With these two modifications, The file 
> upload completes successfully.
> I also modified:
>  * TestInputStreamEntity.testBasics() (from the httpCore project) test so 
> that it complies with getContent()'s Javadoc.
>  * TestDefaultClientRequestDirector.FaultyHttpRequestExecutor because it 
> didn't consume the entity's content.
> All the tests from both httpCore and httpClient pass.
> I tested both InputStreamEntity and BasicHttpEntity.
>  
> Please keep in mind that I am by no means an httpClient (or http, for that 
> matter) expert, and these modifications may have some unexpected side-effects 
> that I did not foresee, contain plain dumb code, or whatever, so it would be 
> great if someone could review my changes and give their opinion.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to