Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a validator for HTTP to show if my vendor's API is creating a poorly formed POST?

I apologize if this isn't the right forum for this, but I couldn't figure out where this question fits in all the sites. My vendor has an API for upload a file to a server, creating a POST with Content-Type: multipart/form-data. My node.js express cannot parse the request, and when using other tools to generate upload requests the main difference I see, in Fiddler, is that there is one section between boundaries with absolutely no content. E.g.:

POST /upload HTTP/1.1
Content-Type: multipart/form-data; boundary=887c07d2-ff01-4eaa-b374-a807f9673742
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.7.0_15
Host: 192.168.1.109:3000
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 2539

--887c07d2-ff01-4eaa-b374-a807f9673742
--887c07d2-ff01-4eaa-b374-a807f9673742
Content-Disposition: form-data; name="Filename"

picture_178.jpg
--887c07d2-ff01-4eaa-b374-a807f9673742
Content-Disposition: form-data; name="folder"

whatever
--887c07d2-ff01-4eaa-b374-a807f9673742
Content-Disposition: form-data; name="Filedata"; filename="picture_178.jpg"
Content-Type: image/jpeg

......JFIF.....H.H.....C.........................................
(etcetera)

I've looked at the relevant RFCs and I think this is not valid, but is there some tool to help me gain agreement on this to demonstrate to my vendor? I know about the HTML validators, and other validators, but I couldn't find anything to validate the line protocol results.

Thanks.

like image 579
JustTrying Avatar asked Feb 23 '13 16:02

JustTrying


1 Answers

I wouldn't know of any online validation tool, but the multipart spec demands parts between boundaries to be RFC 822 compliant messages. Since said RFC requires messages to have some whitespaces at least, an empty string does not suffice. Hence I believe, the example isn't a valid multipart message.

like image 108
DaSourcerer Avatar answered Dec 03 '22 03:12

DaSourcerer