Hi Marius,

Please try setting the contentType and charSet of the parts to null. This will keep these values from being sent. It seems that some servers are unable to handle posts that have these multipart values included. You can do this via:

PartBase.setCharSet(null)
  and
PartBase.setContentType(null)

Mike


On Jun 19, 2004, at 6:34 PM, Marius Barbulescu wrote:

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 <src.tar.gz>----------------------------------------------------------- ----------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to