File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22require 'forwardable'
33require 'webmachine/constants'
44require 'ipaddr'
5- require 'socket'
65
76module Webmachine
87 # Request represents a single HTTP request sent from a client. It
@@ -185,7 +184,7 @@ def parse_addr(string)
185184 end
186185
187186 # Pass address, port to Addrinfo.tcp. It will raise SocketError if address or port is not valid.
188- Addrinfo . tcp ( address , port )
187+ [ IPAddr . new ( address ) . to_s , port . to_i ]
189188 end
190189
191190 def build_uri ( uri , headers )
@@ -194,11 +193,11 @@ def build_uri(uri, headers)
194193 return uri
195194 end
196195
197- addr = parse_addr ( headers . fetch ( HOST ) )
196+ addr , port = parse_addr ( headers . fetch ( HOST ) )
198197
199198 uri . scheme = HTTP
200- uri . host = addr . ip_address
201- uri . port = addr . ip_port == 0 ? 80 : addr . ip_port
199+ uri . host = addr
200+ uri . port = port == 0 ? 80 : port
202201
203202 uri
204203 end
You can’t perform that action at this time.
0 commit comments