1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Fix other places where we should use bytesize

This commit is contained in:
Evan Phoenix 2012-03-29 15:26:03 -07:00
parent dcc93b0e0e
commit e74b8621c6

View file

@ -235,9 +235,9 @@ module Puma
return return
end end
nparsed += parser.body.size if cl nparsed += parser.body.bytesize if cl
if data.size > nparsed if data.bytesize > nparsed
data.slice!(0, nparsed) data.slice!(0, nparsed)
parser.reset parser.reset
env = @proto_env.dup env = @proto_env.dup
@ -293,7 +293,7 @@ module Puma
if host = env[HTTP_HOST] if host = env[HTTP_HOST]
if colon = host.index(":") if colon = host.index(":")
env[SERVER_NAME] = host[0, colon] env[SERVER_NAME] = host[0, colon]
env[SERVER_PORT] = host[colon+1, host.size] env[SERVER_PORT] = host[colon+1, host.bytesize]
else else
env[SERVER_NAME] = host env[SERVER_NAME] = host
env[SERVER_PORT] = PORT_80 env[SERVER_PORT] = PORT_80
@ -371,7 +371,7 @@ module Puma
no_body = false no_body = false
if res_body.kind_of? Array and res_body.size == 1 if res_body.kind_of? Array and res_body.size == 1
content_length = res_body[0].size content_length = res_body[0].bytesize
end end
cork_socket client cork_socket client
@ -502,7 +502,7 @@ module Puma
def read_body(env, client, body, cl) def read_body(env, client, body, cl)
content_length = cl.to_i content_length = cl.to_i
remain = content_length - body.size remain = content_length - body.bytesize
return StringIO.new(body) if remain <= 0 return StringIO.new(body) if remain <= 0