Summary: | Invalid request using Proxy for a multipart/form-data with no filename specified. | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Benjamin Francisoud <a_cogito> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 2.1.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Attachments: |
Cocoon stacktrace
simple multipart form webrick - ruby on rails - stacktrace replace sampler.getFileField() with sampler.getFilename() junit test case for PostWriter |
Description
Benjamin Francisoud
2005-11-30 14:25:19 UTC
Created attachment 17084 [details]
Cocoon stacktrace
Created attachment 17086 [details]
simple multipart form
The simple html page I used in ruby on rails to reproduce the problem with the
jmeter proxy.
Created attachment 17087 [details]
webrick - ruby on rails - stacktrace
The stacktrace I get when using jmeter proxy with the simple form with no
filename specified.
I spotted the problem in org.apache.jmeter.protocol.http.sampler.PostWriter.java In sendPostData(), the filename is tested with those lines: String filename = sampler.getFilename(); if ((filename != null) && (filename.trim().length() > 0)) { But in setHeaders(), the filename is not use: String filename = sampler.getFileField(); if ((filename != null) && (filename.trim().length() > 0)) { Where sampler.getFileField() is the "name" attribut of the html input ("upload" in my simple multipart form attachment file), therefore wrong headers a used. See patch-bug-37716.txt Created attachment 17088 [details]
replace sampler.getFileField() with sampler.getFilename()
Created attachment 17089 [details]
junit test case for PostWriter
Test all public methodes of PostWriter.
Place it under:
[jmeter-workspace]/test/src/org/apache/jmeter/protocol/http/sampler
Done under windows XP and eclipse 3.1.
Launch from eclipse: green bar.
Launch from ant: green bar.
Thanks very much - it's particularly useful to have the JUnit testcase. I've applied the patch to the 2.1 branch. BTW, PostWriter.CRLF and PostWriterTest.CRLF need to remain private - final arrays are mutable (unless they have zero entries), so it's not completely safe to share them. solve with the latest svn sources :) This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1642 |