-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PUT&POST - do not require length #30
Comments
Why? Can you show the use-case for this? |
sure, |
I think we should allow these requests, as they appear to be valid according to RFC 7230 section 3.3.3 (number 6 in list allows for no Content-Length if body is empty): https://tools.ietf.org/html/rfc7230#section-3.3.3 |
RFC 7230 section 3.3.3 allows for this. Fixes ruby#30
RFC 7230 section 3.3.3 allows for this. Fixes ruby#30
RFC 7230 section 3.3.3 allows for this. Fixes #30
It seems like WEBrick still doesn't allow POST/PUT requests with empty body, but the difference now is that the server doesn't respond with a 411, instead the request is blocked forever because the server gets stuck at the webrick/lib/webrick/httprequest.rb Line 525 in cda6d40
I can repro with this script: require 'webrick'
class Simple < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
puts "Hello world!"
res.status = 200
res.body = "Hello world!"
end
alias do_POST do_GET
end
server = WEBrick::HTTPServer.new(Port: 9988) server.logger.level = 5
server.mount '/', Simple
server.start And:
Edit: My use-case is I have a web service whose job is to generate a bunch of config files. I'd like to have an endpoint that I can POST to to make the service regenerate the config files. It doesn't need any data from the client to do its job so the POST request will have an empty body. |
Could you please remove BODY_CONTAINABLE_METHODS check:
Allow POSt and PUT methods with empty body and without Content-Length=0 header
The text was updated successfully, but these errors were encountered: