socketry / async-http

MIT License
320 stars 46 forks source link

Fix 204 No Content server response #50

Closed binarycode closed 4 years ago

binarycode commented 4 years ago

This PR fixes bug introduced in 5f63e9c: if server tries to respond with 204 No Content response that does not contain body, following exception is raised:

NoMethodError: undefined method `version' for nil:NilClass
  /app/lib/async/http/protocol/http1/server.rb:97 in `each'
  /app/lib/async/http/server.rb:53 in `accept'
  /app/vendor/ruby/2.6.0/gems/async-io-1.29.0/lib/async/io/server.rb:32 in `block in accept_each'
  /app/vendor/ruby/2.6.0/gems/async-io-1.29.0/lib/async/io/socket.rb:73 in `block in accept'
  /app/vendor/ruby/2.6.0/gems/async-1.25.2/lib/async/task.rb:258 in `block in make_fiber'
ioquatix commented 4 years ago

This is a blocking issue on an internal project so I am going to fix it now. However, thanks so much for your PR and your effort investigating the issue!