Web-frameworks: POST fail on jester

Created on 4 Jun 2018  路  13Comments  路  Source: the-benchmarker/web-frameworks

Hi,

Sending a POST requests on jester return an HTTP/1.1 411 Length Required.

@dom96 How can I specify length to use ?

Regards,

Most helpful comment

For note, as per RFC2616, the content-length header is NOT REQUIRED on HTTP/1.1 compatible clients and servers, it is only required if in HTTP/1.0 mode, thus it seems jester is in the wrong here.

All 13 comments

Content-Length header?

You need either that or Connection: Close as per the HTTP spec IIRC

@dom96 and how can I implement that ?

What are you trying to do?

@dom96 I'm doing a simple
~sh
curl -vIL -X POST "http://${IP}:3000/user
~

Have I to add something here : https://github.com/tbrand/which_is_the_fastest/blob/master/nim/jester/server_nim_jester.nim#L13 ?

Try one of these: https://gist.github.com/subfuzion/08c5d85437d5d4f00e58#post-applicationx-www-form-urlencoded

@dom96 you mean a POST could not be empty on jester ?

--data "" should be enough.

@dom96 sure.

it strange, so far, since working on several other frameworks (including in nim)
https://travis-ci.com/waghanza/which_is_the_fastest/builds/75262460#L733

Perhaps, but I've found others that ran into the same issue with other frameworks/httpds: https://stackoverflow.com/questions/2885274/post-with-curl-without-sending-data#comment32877025_2924677

I'll investigate this later in any case to see what the HTTP spec has to say about it. https://github.com/dom96/jester/issues/142

@dom96 The faulty behaviour (having a 411 on POST) seems to appear only on curl

Using the built-in crystal http/client leads me to 200 as expected

@see working on jester test => https://travis-ci.com/waghanza/which_is_the_fastest/jobs/127855887

That's because curl doesn't send the "Content-Length" header for some reason. The Crystal HTTP client must do so automatically. You can still use curl but you have to specify --data "" on the command line.

For note, as per RFC2616, the content-length header is NOT REQUIRED on HTTP/1.1 compatible clients and servers, it is only required if in HTTP/1.0 mode, thus it seems jester is in the wrong here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dalbhat picture dalbhat  路  11Comments

ansarizafar picture ansarizafar  路  11Comments

waghanza picture waghanza  路  10Comments

waghanza picture waghanza  路  11Comments

kalicki picture kalicki  路  4Comments