1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/webrick/ssl.rb (WEBrick::Config::SSL): the default value

of :SSLEnable is false.

* lib/webrick/server.rb (WEBrick::Daemon.start): prepared stdio
  don't allow changing its mode.

* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_service):
  should delete trailing LF from the result of pack("m*").

* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_connect):
  - should delete trailing LF from the result of pack("m*").
  - clear Request-Line not to send the response by HTTPServer#run.

* lib/webrick/httputils (WEBrick::HTTPUtils.parse_qvalues):
  refine regexp (and change the name of a local variable).

* lib/webrick/httputils.rb (WEBrick::HTTPUtils#escape_path): add
  new method to escape URI path component.

* lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line): should
  escape SCRIPT_NAME and PATH_INFO before being parsed as a URI.

* test/webrick/*, sample/webrick/httpproxy.rb: add new file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gotoyuzo 2005-01-18 06:03:43 +00:00
parent 9f1945ac53
commit fb18f0d973
7 changed files with 65 additions and 42 deletions

View file

@ -15,6 +15,14 @@ require "net/http"
Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
module WEBrick
NullReader = Object.new
class << NullReader
def read(*args)
nil
end
alias gets read
end
class HTTPProxyServer < HTTPServer
def initialize(config)
super
@ -111,6 +119,7 @@ module WEBrick
proxy_port = proxy.port
if proxy.userinfo
credentials = "Basic " + [proxy.userinfo].pack("m*")
credentials.chomp!
header['proxy-authorization'] = credentials
end
end
@ -171,6 +180,7 @@ module WEBrick
proxy_request_line = "CONNECT #{host}:#{port} HTTP/1.0"
if proxy.userinfo
credentials = "Basic " + [proxy.userinfo].pack("m*")
credentials.chomp!
end
host, port = proxy.host, proxy.port
end
@ -211,6 +221,10 @@ module WEBrick
end
res.send_response(ua)
access_log(@config, req, res)
# Should clear request-line not to send the sesponse twice.
# see: HTTPServer#run
req.parse(NullReader) rescue nil
end
begin