Hello all, I would like to know what the status of multipart HTTP request currently is. I read from the docs that it's experimental but to me it feels like there's currently a regression (is there any working example?). I have some requests that were working correctly up to 7.6.1 AFAIR. From 7.8 on (including latest) I always get this error message when posting multipart requests:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 Stopped at .../restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</title> </head> <body> <h2>HTTP ERROR 400</h2> <p>Problem accessing /multipart. Reason:
<pre> Stopped at /home/lettere/Desktop/basex80/webapp/restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</pre> </p> <hr /> <i> <small>Powered by Jetty://</small> </i> <br/> [...] <br/> </body> </html>
This is the entry point:
declare %restxq:path("multipart/") %restxq:POST("{$message}") %restxq:consumes("multipart/form-data") %output:method('xml') function page:hello2($message) { <response> <title>Hello!</title> content <info>It seems you posted a message: { $message }</info> </response> };
and finally this is the HTTP request:
POST /multipart HTTP/1.1 Host: localhost:9000 Connection: keep-alive Content-Length: 162 Cache-Control: no-cache Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Content-Type: multipart/form-data; boundary='bounds' Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,it;q=0.6
--bounds Content-Disposition: content Content-Type: application/xml
<a/>
--bounds Content-Disposition: metadata Content-Type: application/xml
<b/>
--bounds
Thanks a lot, Marco.
Sounds like a bug! I'll check this out.
Beforehand: Do you think that the "experimental solution" for multipart that we were proposing already covers all your needs?
Christian
On Thu, Jun 19, 2014 at 9:38 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello all, I would like to know what the status of multipart HTTP request currently is. I read from the docs that it's experimental but to me it feels like there's currently a regression (is there any working example?). I have some requests that were working correctly up to 7.6.1 AFAIR. From 7.8 on (including latest) I always get this error message when posting multipart requests:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 Stopped at .../restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</title> </head> <body> <h2>HTTP ERROR 400</h2> <p>Problem accessing /multipart. Reason:
<pre> Stopped at
/home/lettere/Desktop/basex80/webapp/restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</pre> </p> <hr /> <i> <small>Powered by Jetty://</small> </i> <br/> [...] <br/> </body>
</html>
This is the entry point:
declare %restxq:path("multipart/") %restxq:POST("{$message}") %restxq:consumes("multipart/form-data") %output:method('xml') function page:hello2($message) {
<response> <title>Hello!</title> content <info>It seems you posted a message: { $message }</info> </response> };
and finally this is the HTTP request:
POST /multipart HTTP/1.1 Host: localhost:9000 Connection: keep-alive Content-Length: 162 Cache-Control: no-cache Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Content-Type: multipart/form-data; boundary='bounds' Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,it;q=0.6
--bounds Content-Disposition: content Content-Type: application/xml
<a/>
--bounds Content-Disposition: metadata Content-Type: application/xml
<b/>
--bounds
Thanks a lot, Marco.
With a bit of delay (sorry) and just to close this point. I discovered that the implementation is strictly adhering to the HTTP specification that REQUIRES the new lines to be \r\n whereas in my request the newlines were \n only. This made it parse all way down to the end of the message without finding a multipart content where it was actually expecting one. It could be just a one-liner in the code to handle \n only but I suppose it's a bad practice to be fmore flexible than the specifications allows. Thanks for the support! M.
On 06/24/2014 01:58 PM, Christian Grün wrote:
Sounds like a bug! I'll check this out.
Beforehand: Do you think that the "experimental solution" for multipart that we were proposing already covers all your needs?
Christian
On Thu, Jun 19, 2014 at 9:38 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello all, I would like to know what the status of multipart HTTP request currently is. I read from the docs that it's experimental but to me it feels like there's currently a regression (is there any working example?). I have some requests that were working correctly up to 7.6.1 AFAIR. From 7.8 on (including latest) I always get this error message when posting multipart requests:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 Stopped at .../restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</title> </head> <body> <h2>HTTP ERROR 400</h2> <p>Problem accessing /multipart. Reason:
<pre> Stopped at
/home/lettere/Desktop/basex80/webapp/restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</pre> </p> <hr /> <i> <small>Powered by Jetty://</small> </i> <br/> [...] <br/> </body>
</html>
This is the entry point:
declare %restxq:path("multipart/") %restxq:POST("{$message}") %restxq:consumes("multipart/form-data") %output:method('xml') function page:hello2($message) {
<response> <title>Hello!</title> content <info>It seems you posted a message: { $message }</info> </response> };
and finally this is the HTTP request:
POST /multipart HTTP/1.1 Host: localhost:9000 Connection: keep-alive Content-Length: 162 Cache-Control: no-cache Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Content-Type: multipart/form-data; boundary='bounds' Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,it;q=0.6
--bounds Content-Disposition: content Content-Type: application/xml
<a/>
--bounds Content-Disposition: metadata Content-Type: application/xml
<b/>
--bounds
Thanks a lot, Marco.
Glad to have this solved. Thanks for the feedback! Christian
On Tue, Jul 8, 2014 at 1:14 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
With a bit of delay (sorry) and just to close this point. I discovered that the implementation is strictly adhering to the HTTP specification that REQUIRES the new lines to be \r\n whereas in my request the newlines were \n only. This made it parse all way down to the end of the message without finding a multipart content where it was actually expecting one. It could be just a one-liner in the code to handle \n only but I suppose it's a bad practice to be fmore flexible than the specifications allows. Thanks for the support!
M.
On 06/24/2014 01:58 PM, Christian Grün wrote:
Sounds like a bug! I'll check this out.
Beforehand: Do you think that the "experimental solution" for multipart that we were proposing already covers all your needs?
Christian
On Thu, Jun 19, 2014 at 9:38 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello all, I would like to know what the status of multipart HTTP request currently is. I read from the docs that it's experimental but to me it feels like there's currently a regression (is there any working example?). I have some requests that were working correctly up to 7.6.1 AFAIR. From 7.8 on (including latest) I always get this error message when posting multipart requests:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 Stopped at .../restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</title> </head> <body> <h2>HTTP ERROR 400</h2> <p>Problem accessing /multipart. Reason:
<pre> Stopped at
/home/lettere/Desktop/basex80/webapp/restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</pre> </p> <hr /> <i> <small>Powered by Jetty://</small> </i> <br/> [...] <br/> </body>
</html>
This is the entry point:
declare %restxq:path("multipart/") %restxq:POST("{$message}") %restxq:consumes("multipart/form-data") %output:method('xml') function page:hello2($message) {
<response> <title>Hello!</title> content <info>It seems you posted a message: { $message }</info> </response> };
and finally this is the HTTP request:
POST /multipart HTTP/1.1 Host: localhost:9000 Connection: keep-alive Content-Length: 162 Cache-Control: no-cache Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Content-Type: multipart/form-data; boundary='bounds' Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,it;q=0.6
--bounds Content-Disposition: content Content-Type: application/xml
<a/>
--bounds Content-Disposition: metadata Content-Type: application/xml
<b/>
--bounds
Thanks a lot, Marco.
Hi Marco,
I didn't have much time to dive into the issue, but if I get the specifications right, you cannot use simple quotes for specifying boundary strings:
http://www.w3.org/Protocols/rfc1341/4_Content-Type.html http://www.w3.org/Protocols/rfc822/Overview.html
Hope this helps, Christian
On Thu, Jun 19, 2014 at 9:38 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello all, I would like to know what the status of multipart HTTP request currently is. I read from the docs that it's experimental but to me it feels like there's currently a regression (is there any working example?). I have some requests that were working correctly up to 7.6.1 AFAIR. From 7.8 on (including latest) I always get this error message when posting multipart requests:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 Stopped at .../restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</title> </head> <body> <h2>HTTP ERROR 400</h2> <p>Problem accessing /multipart. Reason:
<pre> Stopped at
/home/lettere/Desktop/basex80/webapp/restxq.xqm, 106/10: [experr:HC0004] Invalid request element: No body specified for http:part.</pre> </p> <hr /> <i> <small>Powered by Jetty://</small> </i> <br/> [...] <br/> </body>
</html>
This is the entry point:
declare %restxq:path("multipart/") %restxq:POST("{$message}") %restxq:consumes("multipart/form-data") %output:method('xml') function page:hello2($message) {
<response> <title>Hello!</title> content <info>It seems you posted a message: { $message }</info> </response> };
and finally this is the HTTP request:
POST /multipart HTTP/1.1 Host: localhost:9000 Connection: keep-alive Content-Length: 162 Cache-Control: no-cache Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Content-Type: multipart/form-data; boundary='bounds' Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,it;q=0.6
--bounds Content-Disposition: content Content-Type: application/xml
<a/>
--bounds Content-Disposition: metadata Content-Type: application/xml
<b/>
--bounds
Thanks a lot, Marco.
basex-talk@mailman.uni-konstanz.de