PlanetJava
Custom Search

java-grinder-user
[Top] [All Lists]

Re: multipart form submission.......

Subject: Re: multipart form submission.......
Date: Mon, 15 Dec 2008 19:58:18 +0000
RUSSELL Scott wrote:
> Yes, I agree that I am specifying it twice.  You suggest a different approach 
> to the one I had.  This makes logical sense to me, and whilst I agree with 
> the logic, in practise this does not bear fruit.  Essentially, this removes 
> the parameter "filename" from the headers. Which my script seems to require, 
> and it fails.
>
> Ie in proxy capture this line is missing...
>
> -----------------------------137357244014788080171010743019
> Content-Disposition: form-data; name="body:form:documentFilename"
>
> scott.zip
>   
But you set that explicitly -
         NVPair('body:form:documentFilename', ''+filename1+''),
you didn't remove that line did you?
> What I did do instead, was to remove the "b" from the following line
>
> file1 = open("document/"+filename1+"", 'rb')
>
> Ie, make the file text.  The upload now fails, but add it back in and it 
> works.  So this "indicates" that the actual file being uploaded is the one 
> specified by the line
>
> NVPair('body:form:documentFile\"; filename=\"'+filename1+'',''+zipfile+''),
>
> So I seem to need this line, which is not where I want to be.....
>
> Next I tried tried specifying the files variable as...
>
>      files= None
>
> This seems to work, and I only have one upload in the file.  However, the
>
> " Content-Type: application/octet-stream"
>
> Appears to be missing from the proxy capture.  But it does seem to work.
>
>   
The answers are probably in HTTPClient.Codecs.java if you look long and
hard enough. We know that must be copying the data into your request,
because you see it disapear if you set it to None. So now we need to
make it look like the version you are putting into the headers under
your own sweat. In your original you had:
    ----------ieoau._._+2_8_GoodLuck8.3-ds0d0J0S0Kl234324jfLdsjfdAuaoei-----
    Content-Disposition: form-data; name="body:form:documentFile"; 
filename="scott.zip"
    ....
and
    ----------ieoau._._+2_8_GoodLuck8.3-ds0d0J0S0Kl234324jfLdsjfdAuaoei-----
    Content-Disposition: form-data; name="body:form:documentFile"; 
filename="scott.zip"
    Content-Type: application/octet-stream
    ....
Presumably the first is from what you set in headers and the second is
from files (since the Content-Type is there). I am surprised that the
separators are the same though, since mpFormDataEncode mangles the
header for each part to make it unique. Did you really copy the content
verbatim?
- Phil
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy