hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Question regarding Bug 20744
Date Mon, 21 Jun 2004 05:33:16 GMT
Hello Marius,

if it makes you feel better:
There is a solution to your problem.
Don't know which one, but there is...
(Sorry, I couldn't help it :-)

You did notice that in the browser protocol,
the uploaded file seems to be "1.html", while
in the HttpClient protocol, it is "bom12.txt".
In the source code, there is a reference to
a file "1.html", but that one is downloaded 
and saved, not uploaded. Does this matter?

Also, in the source code the filename
"bom12.txt" is hardcoded rather than taken
from the constructor argument, which reads
"/udir/projects/uploaded/src/bom12.txt".
Does this matter? It seems not, since the
file contents shows up in the request.

Finally, the browser sends a single cookie
header with old-style cookies, while
HttpClient sends individual cookie headers
with new-style cookies. The web server may
have a problem with that.

Have you tried reading the body of the last
response from the server? It may contain an
indication what the problem is.

The two protocols indicate different server
versions and different proxies inbetween. Did
you test both cases in the same environment?

The additional -- is not a problem. If you
count the dashes in the browser protocol,
you will notice that it also contains two more
dashes between the parts than indicated in
the "boundary" value.

Sorry, I don't have the time to actually
dig into the application level protocol of
"azure.freeservers.com". Since the server
responds with status 200 rather than 40x,
I'd rather search the problem there if 
tweaking the cookie header format does
not solve it.

hope that helps anyway,
  Roland






Marius Barbulescu <barbulescumarius@yahoo.com> 
20.06.2004 00:34
Please respond to
"Commons HttpClient Project"


To
commons-httpclient-dev@jakarta.apache.org
cc

Subject
Question regarding Bug 20744






Hello all,

I implemented Dirk's workaround but I still cannot upload the 
file using httpclient, but I can do this using a common browser (IE, 
Mozilla, Opera...).
Please tell if you see any mistake I made or if it is any solution for 
this problem.

I use httpclient 2.0 final, j2sdk 1.4.2 and j2sdk 1.5.

I see a strange '--' in each part but I don't know if it correct or not.

Thank you,
Marius

Here is the conversation using a common browser

================================= start =============================

POST http://azure.freeservers.com/cgi-bin/util/fm_nmp/?Xtime=1087543300725 
HTTP/1.1
Host: azure.freeservers.com
User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.4) 
Gecko/20030701
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: http://azure.freeservers.com/cgi-bin/util/fm/?showupload=1
Cookie: usage=fm:1:20040618%2Csite_admin:1:20040618%2C;
aws_member=d795a0631c8117efbab1fbfdf9c38c07; 
LOGIN=YXp1cmUuZnJlZXNlcnZlcnMuY29tOm02bTZtNg%3D%3D;
PostLH=3347881

Content-Type: multipart/form-data; 
boundary=---------------------------16838575810113
Content-Length: 1019
-----------------------------16838575810113
Content-Disposition: form-data; name="destfolder1"

Choose a Destination...
-----------------------------16838575810113
Content-Disposition: form-data; name="uploadfile1"; filename="1.html"
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
The document has moved <A
HREF="
http://azure.freeservers.com/cgi-bin/util/site_admin?userpass=YXp1cmUuZnJlZXNlcnZlcnMuY29tOm02bTZtNg==
">here</A>.<P>
</BODY></HTML>

-----------------------------16838575810113
Content-Disposition: form-data; name="upload"

Upload!
-----------------------------16838575810113
Content-Disposition: form-data; name="selector"


-----------------------------16838575810113
Content-Disposition: form-data; name="viewer"


-----------------------------16838575810113
Content-Disposition: form-data; name="destfolder2"

Choose a Destination...
-----------------------------16838575810113--

HTTP/1.x 200 OK
Date: Fri, 18 Jun 2004 07:15:32 GMT
Content-Type: text/html
Server: .V22 Apache/1.3.26 (Unix) mod_fs 6.005
Partner-Revision: 1.345
Via: 1.1 netcache1 (NetCache NetApp/5.5R2)
X-Cache: MISS from cache.mrc.alcatel.ro
Proxy-Connection: close

================================= end =============================

Here is the conversation using httpclient

================================= start =============================


[DEBUG] HttpConnection - -HttpConnection.setSoTimeout(0)
[DEBUG] HttpMethodBase - -Execute loop try 1
[DEBUG] wire - ->> "POST /cgi-bin/util/fm_nmp/?Xtime=1087683916170 
HTTP/1.1[\r][\n]"
[DEBUG] HttpMethodBase - -Adding Host request header
[DEBUG] wire - ->> "User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; 
rv:1.4)
Gecko/20030701[\r][\n]"
[DEBUG] wire - ->> "Accept-Language: en-us,en;q=0.5[\r][\n]"
[DEBUG] wire - ->> "Keep-Alive: 300[\r][\n]"
[DEBUG] wire - ->> "Accept-Charset: utf-8;q=0.7,*;q=0.7[\r][\n]"
[DEBUG] wire - ->> "Proxy-Connection: keep-alive[\r][\n]"
[DEBUG] wire - ->> "Host: azure.freeservers.com[\r][\n]"
[DEBUG] wire - ->> "Cookie: $Version=0; 
usage=fm:1:20040619%2Csite_admin:1:20040619%2C;
$Path=/cgi-bin/util/[\r][\n]"
[DEBUG] wire - ->> "Cookie: $Version=0; 
LOGIN=YXp1cmUuZnJlZXNlcnZlcnMuY29tOm02bTZtNg%3D%3D;
$Path=/[\r][\n]"
[DEBUG] wire - ->> "Cookie: $Version=0; PostLH=9904507; $Path=/[\r][\n]"
[DEBUG] wire - ->> "Cookie: $Version=0; 
aws_member=d795a0631c8117efbab1fbfdf9c38c07;
$Path=/[\r][\n]"
[DEBUG] wire - ->> "Content-Length: 751[\r][\n]"
[DEBUG] wire - ->> "Content-Type: multipart/form-data;
boundary=----------------314159265358979323846[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "uploadfile1"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "; filename="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "bom12.txt"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Type: "
[DEBUG] wire - ->> "application/octet-stream"
[DEBUG] wire - ->> "; charset="
[DEBUG] wire - ->> "ISO-8859-1"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "bom12"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "submit"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Login!"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "selector"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "viewer"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "destfolder1"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Choose a Destination..."
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Content-Disposition: form-data; name="
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "destfolder2"
[DEBUG] wire - ->> """
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "Choose a Destination..."
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "----------------314159265358979323846"
[DEBUG] wire - ->> "--"
[DEBUG] wire - ->> "[\r][\n]"
[DEBUG] wire - -<< "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] wire - -<< "Date: Sat, 19 Jun 2004 22:21:54 GMT[\r][\n]"
[DEBUG] wire - -<< "Server: .V25 Apache/1.3.26 (Unix) mod_fs 
6.005[\r][\n]"
[DEBUG] wire - -<< "Partner-Revision: 1.345[\r][\n]"
[DEBUG] wire - -<< "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] wire - -<< "Content-Type: text/html[\r][\n]"
[DEBUG] HttpConnection - -HttpConnection.getSoTimeout()
[DEBUG] HttpMethodBase - -Buffering response body

================================= end =============================






 
 
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail [attachment "src.tar.gz" deleted by 
Roland Weber/Germany/IBM] 
---------------------------------------------------------------------
To unsubscribe, e-mail: 
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: 
commons-httpclient-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message