DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41705>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41705





------- Additional Comments From [EMAIL PROTECTED]  2007-03-15 03:20 -------
(In reply to comment #5)
> Applied to SVN. It will be in the next nightly build.

Thanks

> 
> What about the file encoding? Is that still needed?
> 

I'm assuming you are referring to the encoding used when send files as part of
the POST.
The file is either sent as the post body or as a multipart.

For the PostWriter.java, which is used by the HTTPSampler.java, the file content
is in both scenarios sent raw, i.e. the bytes are read directly from the input
file, and sent as raw bytes to the web server.
The parameters sent in the multipart is always encoded as iso-8859-1.
The encoding specified for the POST request is not used at all in that case.
I think that is correct, because I think the parameters should be encoded using
iso-8859-1.

For the HTTPSampler2.java (the one using HttpClient code), the two scenarioes
are handled differently, from what I can see from the code.
If the file is sent as the post body, then the bytes are sent raw.
If the file is sent as a multipart, then currently the code does this :
//TODO should allow charset to be defined ...
parts[i]= new FilePart(getFileField(), input, getMimetype(), "UTF-8" 
);//$NON-NLS-1$

This looks to me like one assumes that the input text file is encoded using
utf-8, and one includes a "; charset=" in the "Content-Type:" which is sent in
the multipart for the file.
In my opinion, this makes HTTPSampler and HTTPSampler2 send different data to
the web server if the file is sent as multipart.
The HTTPSampler always include a "; charset=UTF-8".

Either one can remove the hardcoded "UTF-8" in the HTTPSampler2, and just use
null for charset when constructing the FilePart. Then FilePart will have default
charset, which is "ISO-8859-1". Then one could explicitly do "setCharSet(null)"
on the FilePart. With charset set to null, the "; charset=" will not be included
when the multiform is sent.
I've been looking at the source for the files in the
org.apache.commons.httpclient.methods.multipart package.

Or one can let the HTTPSampler2 use the specified "Content encoding" parameter
when constructing the FilePart. Then I think one should also change the
PostWriter, so that it includes the "; charset" in the "Content-Type" in the
writeFileToURL method in the PostWriter, if the "Content encoding" parameter is
specified for the sampler.

I prefer to add support for having the "; charset=" set to the "content
encoding" specified by the user. If others prefer that as well, I can supply a
patch.

> As regards the HTTPSampleResult/View Results issue - probably best to raise a 
> separate Bugzilla entry for that.
I might have a closer look at the "View results" issue, and if I do, I will open
a separate entry for it.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to