HTTP MultiPart does not implement Strict mode - RFC 822, RFC 2045, RFC 2046...
Distributed load testing framework - Java, Jython, or Clojure scripts.
Brought to you by:
philipa
When:
Creating a multipart POST request, combining files and fields, like following:
def data = Codecs.mpFormDataEncode([new NVPair ("passphrase", "value")], [new NVPair ("file", "path")], headers) request.POST(url, data, headers)
Expecting:
POST /url HTTP/1.1 Accept: application/json Content-Length: 3154 Content-Type: multipart/form-data; boundary=pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Host: 127.0.0.1:8080 Connection: Keep-Alive Accept-Encoding: gzip,deflate --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Content-Disposition: form-data; name="file"; filename="path" Content-Type: application/octet-stream Content-Transfer-Encoding: binary 00*H00O*H@0<05*H0 (shortened) --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Content-Disposition: form-data; name="passphrase" Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit value --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB--
Actual value:
POST /url HTTP/1.1 Accept: application/json Connection: Keep-Alive, TE TE: trailers User-Agent: RPT-HTTPClient/0.3-3E Content-Length: 3154 Content-Type: multipart/form-data; boundary=pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Host: 127.0.0.1:8080 Connection: Keep-Alive Accept-Encoding: gzip,deflate --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Content-Disposition: form-data; name="file"; filename="path" 00*H00O*H@0<05*H0 (shortened) --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB Content-Disposition: form-data; name="passphrase" value --pswSGEhPC4g104FwsgwypOgCF0GOObHBTxKDsOMB--
As you can see, Content-Type and Content-Transfer-Encoding is missing from body parts, causing server to reject the request.
Note, HTTPMime from Apache provides both STRICT and BROWSER_COMPATIBLE way for multipart requests, so implementing both and giving user a choice would work as well.