Re: Multipart/mixed usage in GSP test suite.

On 20/11/12 01:18, Chime Ogbuji wrote:
> Hey Andy, see my response inline below.
>
> On Friday, November 16, 2012 at 1:34 PM, Andy Seaborne wrote:
>> Chime,
>>
>> I have having problems with the multipart POST test. I have tried
>> creating a multipart form POST with curl and also from a HTML form
>> inside chrome. I'm not getting the format of the test. I don't get use
>> for multipart/mixed inside a multipart/form-data.
>>
>> Which tool did you use to create the test example?
> The test example is a hand-crafted version of the multipart form data here:
>
> http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
>
> The actual multipart form content that the validator sends to the protocol instance is at the bottom of this email.  It was easier
> to use the tool to construct a multi-part form request from the components of the request than from the verbatim request as it is in the test example.
>
> The tool is called poster [1] and it doesn't seem to use multipart/mixed as shown in the HTML 4 documentation.

That is because I believe the use of multipart/mixed is not required and 
indeed common practice is not to use it.

Having used Firefox and Chrome, as well as curl, to generate form 
requests, and using the Apache Commons Upload code to parse the incoming 
request, I have not seen any use of multipart/mixed.  I don't believe it 
is common use with browsers, only with email.

> However, that document says "If multiple files are to be returned as the result of a single form entry, they should be returned as 'multipart/mixed' embedded within the 'multipart/form-data'".

The GSP spec only says multipart/form-data needs to be supported.
"""
where each document is uploaded using the standard web form file upload 
widget
"""
nothing about a specific variant.

There are different ways to have multiple files in a form:

* multiple form fields
* one form form field, multiple times

and they all meet the spec text.  What is more, multiple files per form 
field do not use multipart/mixed in the real web.

e.g.

  <input type="file" name="NAME" size="40" multiple="">

but I do not get multipart/mixed.

I get (Chrome, Firefox):

Content-Type = multipart/form-data; 
boundary=---------------------------10497157321038958566787385981

 >>>> Body

-----------------------------10497157321038958566787385981
Content-Disposition: form-data; name="UNSET FILE NAME"; 
filename="datafile.ttl"
Content-Type: application/octet-stream

@prefix :  .

   :p 123 .
   :p 456 .
   :p 789 .

-----------------------------10497157321038958566787385981
Content-Disposition: form-data; name="UNSET FILE NAME"; 
filename="datafile-2.ttl"
Content-Type: application/octet-stream

@prefix :  .

   :p "abc" .
   :p "def" .

-----------------------------10497157321038958566787385981--
<<<< Body

 Andy

>
> --a6fe4cd636164618814be9f8d3d1a0de
> Content-Disposition: form-data; name="lastName.ttl"; filename="lastName.ttl"
> Content-Type: text/turtle; charset=utf-8
>
> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
> < .. person/1 ..> foaf:familyName "Doe"
>
>
> --a6fe4cd636164618814be9f8d3d1a0de
> Content-Disposition: form-data; name="firstName.ttl"; filename="firstName.ttl"
> Content-Type: text/turtle; charset=utf-8
>
> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
> < .. person/1 .. > foaf:givenName "Jane"
>
>
> --a6fe4cd636164618814be9f8d3d1a0de--
>
> [1] http://atlee.ca/software/poster/
>
> --
> Chime Ogbuji
>
> Sent with Sparrow (http://www.sparrowmailapp.com)
>

Received on Tuesday, 20 November 2012 11:11:29 UTC