Closed dedayoa closed 6 years ago
local headers, stream = req:go()
Make sure you assert
this to get the actual error message.
So five minutes after posting this, I ended up solving a problem I'd been on for a whole day...maybe more! ARRGH!
Turns out that my development server (django devserver) was not dealing with the expect:100-continue header semantics.
req.headers:delete("expect")
did the trick.
Question/Suggestion I don't know the reasoning for the expect header being quietly set on the request, but it does pose a problem for the untrained eye/mind. Why not leave setting this option up to the developer?
@daurnimator issue resolved See https://github.com/daurnimator/lua-http/issues/126#issuecomment-416027069. Thanks for the edit. Now I know about ```[lang] :)
Turns out that my development server (django devserver) was not dealing with the expect:100-continue header semantics.
What did it do wrong? Have you filed a bug with them?
I don't know the reasoning for the expect header being quietly set on the request, but it does pose a problem for the untrained eye/mind.
Sending a large request body without it is considered bad behaviour by servers. Even curl sets it! Since curl is so widely used for testing/debugging I'm suprised you were able to find a server that doesn't like it.
Why not leave setting this option up to the developer?
Because they're likely to forget/not know that they're meant to set it. they can opt out by deleting the header as you did.
Well, its a development server built into django and not a production server like nginx or apache. The core team will not consider a case such as this to be a "bug"
Sending a large request body without it is considered bad behaviour by servers. Even curl sets it! Since curl is so widely used for testing/debugging I'm suprised you were able to find a server that doesn't like it.
Now, I understand. Thanks for the help. Much appreciated.
Well, its a development server built into django and not a production server like nginx or apache. The core team will not consider a case such as this to be a "bug"
I'd still file it anyway. Even if it's just to have a closed "wontfix" bug as something point to at in a comment next to your :delete("expect")
line.
Hello @all. This library has worked flawlessly so far, but then I started experiencing an issue. http request seem to freeze and then return nil after a few seconds. I was able to get the same request to work with postman. Also, this only happens for a particular request. My request function
My request headers
Request body
A sample response - using postman
Error from CLI
Thanks in advance