Forum: Ruby-core [ruby-trunk - Bug #7469][Open] WEBrick "Could not determine content-length of response body. Set con

04d072ab8843cfd3d1714faf3a2a0fb2?d=identicon&s=25 meta (mathew murphy) (Guest)
on 2012-11-29 21:03
(Received via mailing list)
Issue #7469 has been reported by meta (mathew murphy).

----------------------------------------
Bug #7469: WEBrick "Could not determine content-length of response body.
Set content-length of the response..." even when content-length is set
https://bugs.ruby-lang.org/issues/7469

Author: meta (mathew murphy)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]


Minimal demonstration code:

########
require 'webrick'

class BugDemonstrator < WEBrick::HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response.body = ''
    response.status = 204
    response.content_length = 0
  end
end

server = WEBrick::HTTPServer.new(:Port => 8080, :AccessLog => [])
server.mount "/", BugDemonstrator
trap("INT") do
  server.shutdown
end
server.start
########

Output when run, connecting to localhost:8080 to issue an HTTP GET:

$ ruby webrickbug.rb
[2012-11-29 13:21:25] INFO  WEBrick 1.3.1
[2012-11-29 13:21:25] INFO  ruby 1.9.3 (2012-11-10) [x86_64-linux]
[2012-11-29 13:21:25] WARN  TCPServer Error: Address already in use -
bind(2)
[2012-11-29 13:21:25] INFO  WEBrick::HTTPServer#start: pid=4941
port=8080
[2012-11-29 13:21:29] WARN  Could not determine content-length of
response body. Set content-length of the response or set
Response#chunked = true
^C[2012-11-29 13:21:32] INFO  going to shutdown ...
[2012-11-29 13:21:32] INFO  WEBrick::HTTPServer#start done.
$ ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
$

I'm doing literally what the warning message says to do -- i.e. setting
the content-length of the response -- but I'm still getting the warning.
6c06915d9aa00cd5c7d4acfb27cdd4e9?d=identicon&s=25 nahi (Hiroshi Nakamura) (Guest)
on 2012-11-30 02:10
(Received via mailing list)
Issue #7469 has been updated by nahi (Hiroshi Nakamura).

Category set to lib
Assignee set to nahi (Hiroshi Nakamura)


----------------------------------------
Bug #7469: WEBrick "Could not determine content-length of response body.
Set content-length of the response..." even when content-length is set
https://bugs.ruby-lang.org/issues/7469#change-34169

Author: meta (mathew murphy)
Status: Open
Priority: Normal
Assignee: nahi (Hiroshi Nakamura)
Category: lib
Target version:
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]


Minimal demonstration code:

########
require 'webrick'

class BugDemonstrator < WEBrick::HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response.body = ''
    response.status = 204
    response.content_length = 0
  end
end

server = WEBrick::HTTPServer.new(:Port => 8080, :AccessLog => [])
server.mount "/", BugDemonstrator
trap("INT") do
  server.shutdown
end
server.start
########

Output when run, connecting to localhost:8080 to issue an HTTP GET:

$ ruby webrickbug.rb
[2012-11-29 13:21:25] INFO  WEBrick 1.3.1
[2012-11-29 13:21:25] INFO  ruby 1.9.3 (2012-11-10) [x86_64-linux]
[2012-11-29 13:21:25] WARN  TCPServer Error: Address already in use -
bind(2)
[2012-11-29 13:21:25] INFO  WEBrick::HTTPServer#start: pid=4941
port=8080
[2012-11-29 13:21:29] WARN  Could not determine content-length of
response body. Set content-length of the response or set
Response#chunked = true
^C[2012-11-29 13:21:32] INFO  going to shutdown ...
[2012-11-29 13:21:32] INFO  WEBrick::HTTPServer#start done.
$ ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
$

I'm doing literally what the warning message says to do -- i.e. setting
the content-length of the response -- but I'm still getting the warning.
233c279c012ebac792aaa805f966cbc7?d=identicon&s=25 steveklabnik (Steve Klabnik) (Guest)
on 2012-11-30 02:44
(Received via mailing list)
Issue #7469 has been updated by steveklabnik (Steve Klabnik).


We were seeing this as well when using webrick with Rails. However,
putting

gem 'webrick', '= 1.3.1'

in the Gemfile seemed to fix it, which is strange, since the standard
library one is also v1.3.1.  Is it possible that the gem is different
than stdlib?
----------------------------------------
Bug #7469: WEBrick "Could not determine content-length of response body.
Set content-length of the response..." even when content-length is set
https://bugs.ruby-lang.org/issues/7469#change-34172

Author: meta (mathew murphy)
Status: Open
Priority: Normal
Assignee: nahi (Hiroshi Nakamura)
Category: lib
Target version:
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]


Minimal demonstration code:

########
require 'webrick'

class BugDemonstrator < WEBrick::HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response.body = ''
    response.status = 204
    response.content_length = 0
  end
end

server = WEBrick::HTTPServer.new(:Port => 8080, :AccessLog => [])
server.mount "/", BugDemonstrator
trap("INT") do
  server.shutdown
end
server.start
########

Output when run, connecting to localhost:8080 to issue an HTTP GET:

$ ruby webrickbug.rb
[2012-11-29 13:21:25] INFO  WEBrick 1.3.1
[2012-11-29 13:21:25] INFO  ruby 1.9.3 (2012-11-10) [x86_64-linux]
[2012-11-29 13:21:25] WARN  TCPServer Error: Address already in use -
bind(2)
[2012-11-29 13:21:25] INFO  WEBrick::HTTPServer#start: pid=4941
port=8080
[2012-11-29 13:21:29] WARN  Could not determine content-length of
response body. Set content-length of the response or set
Response#chunked = true
^C[2012-11-29 13:21:32] INFO  going to shutdown ...
[2012-11-29 13:21:32] INFO  WEBrick::HTTPServer#start done.
$ ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
$

I'm doing literally what the warning message says to do -- i.e. setting
the content-length of the response -- but I'm still getting the warning.
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2012-11-30 03:54
(Received via mailing list)
Issue #7469 has been updated by drbrain (Eric Hodel).

Status changed from Open to Assigned

=begin
I cannot reproduce it with the example code given or by removing
(({response.body = ''})), (({response.content_length = 0})) or both
lines with latest trunk.
=end
----------------------------------------
Bug #7469: WEBrick "Could not determine content-length of response body.
Set content-length of the response..." even when content-length is set
https://bugs.ruby-lang.org/issues/7469#change-34183

Author: meta (mathew murphy)
Status: Assigned
Priority: Normal
Assignee: nahi (Hiroshi Nakamura)
Category: lib
Target version:
ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]


Minimal demonstration code:

########
require 'webrick'

class BugDemonstrator < WEBrick::HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response.body = ''
    response.status = 204
    response.content_length = 0
  end
end

server = WEBrick::HTTPServer.new(:Port => 8080, :AccessLog => [])
server.mount "/", BugDemonstrator
trap("INT") do
  server.shutdown
end
server.start
########

Output when run, connecting to localhost:8080 to issue an HTTP GET:

$ ruby webrickbug.rb
[2012-11-29 13:21:25] INFO  WEBrick 1.3.1
[2012-11-29 13:21:25] INFO  ruby 1.9.3 (2012-11-10) [x86_64-linux]
[2012-11-29 13:21:25] WARN  TCPServer Error: Address already in use -
bind(2)
[2012-11-29 13:21:25] INFO  WEBrick::HTTPServer#start: pid=4941
port=8080
[2012-11-29 13:21:29] WARN  Could not determine content-length of
response body. Set content-length of the response or set
Response#chunked = true
^C[2012-11-29 13:21:32] INFO  going to shutdown ...
[2012-11-29 13:21:32] INFO  WEBrick::HTTPServer#start done.
$ ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
$

I'm doing literally what the warning message says to do -- i.e. setting
the content-length of the response -- but I'm still getting the warning.
This topic is locked and can not be replied to.