Hi all,
I'm using httpclient-4.0-alpha2.jar and httpcore-4.0-alpha6.jar to download a
zip file from a server. My problem is when I try to download part of the zip
file (using Get request, Range header), and the server replies with a '302
Found' response, httpclient automatically submits a new GET request (this is
what I expected) but the Range header is not used for the new GET request. As a
result, I receive a response '200 OK' instead the response '206 Partial
Content'.
My question is if this behavior is correct or a bug? I don't find any documents
from Internet about the expected behavior in this case, but I believe that when
httpclient follows a new location, it should send the headers of the old
request to the new location.
Attached is my sample program (Main1.java) and the log printed by httpclient
4.0-alpha6 (log.txt).
Thanks for your help.
Regards,
Thai
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping0 [main] DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
- ThreadSafeClientConnManager.getConnection:
HttpRoute[{}->http://www.eclipse.org], timeout = 0
0 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - No free
connections. HttpRoute[{}->http://www.eclipse.org]
0 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Creating
new connection. HttpRoute[{}->http://www.eclipse.org]
391 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Stale connection check
406 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies -
CookieSpec selected: compatibility
422 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Attempt 1 to execute request
422 [main] DEBUG org.apache.http.headers - >> GET
/downloads/download.php?file=/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip&url=http://download.eclipse.org/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip&mirror_id=1
HTTP/1.1
422 [main] DEBUG org.apache.http.headers - >> Range: bytes=100-
422 [main] DEBUG org.apache.http.headers - >> Host: www.eclipse.org
422 [main] DEBUG org.apache.http.headers - >> Connection: Keep-Alive
906 [main] DEBUG org.apache.http.headers - << HTTP/1.1 302 Found
906 [main] DEBUG org.apache.http.headers - << Date: Sun, 17 Feb 2008 16:06:48
GMT
906 [main] DEBUG org.apache.http.headers - << Server: Apache
906 [main] DEBUG org.apache.http.headers - << Cache-control: no-cache,
max-age=86400
906 [main] DEBUG org.apache.http.headers - << Set-Cookie:
ECLIPSESESSION=deleted; expires=Sat, 17-Feb-2007 16:06:47 GMT; path=/;
domain=eclipse.org
906 [main] DEBUG org.apache.http.headers - << Set-Cookie:
ECLIPSESESSION=deleted; expires=Sat, 17-Feb-2007 16:06:47 GMT; path=/;
domain=eclipse.org
906 [main] DEBUG org.apache.http.headers - << Location:
http://download.eclipse.org/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip
906 [main] DEBUG org.apache.http.headers - << Expires: Mon, 18 Feb 2008
16:06:48 GMT
906 [main] DEBUG org.apache.http.headers - << Content-Length: 0
906 [main] DEBUG org.apache.http.headers - << Keep-Alive: timeout=3, max=200
906 [main] DEBUG org.apache.http.headers - << Connection: Keep-Alive
906 [main] DEBUG org.apache.http.headers - << Content-Type: text/html;
charset=ISO-8859-1
937 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies -
Cookie accepted: "[version: 0][name: ECLIPSESESSION][name: deleted][domain:
eclipse.org][path: /][expiry: Sat Feb 17 23:06:47 ICT 2007]".
937 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies -
Cookie accepted: "[version: 0][name: ECLIPSESESSION][name: deleted][domain:
eclipse.org][path: /][expiry: Sat Feb 17 23:06:47 ICT 2007]".
937 [main] DEBUG org.apache.http.impl.client.DefaultRedirectHandler -
Redirect requested to location
'http://download.eclipse.org/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip'
937 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Redirecting to
'http://download.eclipse.org/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip'
via HttpRoute[{}->http://download.eclipse.org]
937 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Connection kept alive
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
- Released connection open but not marked reusable.
937 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection -
Connection shut down
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Freeing
connection. HttpRoute[{}->http://www.eclipse.org]
937 [main] DEBUG org.apache.http.impl.conn.IdleConnectionHandler - Adding
connection at: 1203264410287
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Notifying
no-one, there are no waiting threads
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
- ThreadSafeClientConnManager.getConnection:
HttpRoute[{}->http://download.eclipse.org], timeout = 0
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - No free
connections. HttpRoute[{}->http://download.eclipse.org]
937 [main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Creating
new connection. HttpRoute[{}->http://download.eclipse.org]
1281 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Stale connection check
1297 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies -
CookieSpec selected: compatibility
1297 [main] DEBUG org.apache.http.impl.client.DefaultClientRequestDirector -
Attempt 2 to execute request
1297 [main] DEBUG org.apache.http.headers - >> GET
/eclipse/downloads/drops/R-3.3.1.1-200710231652/eclipse-CVS-Client-SDK-3.3.1.1.zip
HTTP/1.1
1297 [main] DEBUG org.apache.http.headers - >> Host: download.eclipse.org
1297 [main] DEBUG org.apache.http.headers - >> Connection: Keep-Alive
2375 [main] DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
2375 [main] DEBUG org.apache.http.headers - << Date: Sun, 17 Feb 2008 16:06:49
GMT
2375 [main] DEBUG org.apache.http.headers - << Server: Apache
2375 [main] DEBUG org.apache.http.headers - << Last-Modified: Thu, 25 Oct 2007
16:05:37 GMT
2375 [main] DEBUG org.apache.http.headers - << ETag:
"11e3372-309e4f-43d5367a09640"
2375 [main] DEBUG org.apache.http.headers - << Accept-Ranges: bytes
2375 [main] DEBUG org.apache.http.headers - << Content-Length: 3186255
2375 [main] DEBUG org.apache.http.headers - << Connection: close
2375 [main] DEBUG org.apache.http.headers - << Content-Type: application/zip
Exception in thread "main" java.lang.IllegalArgumentException: Invalid reponse!
at org.builder.eclipsebuilder.Main1.main(Main1.java:45)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]