Permalink
Browse files

* HTTPClient#set_auth: allow nil as a domain (first parameter). closes

  • Loading branch information...
nahi
nahi committed Dec 8, 2008
1 parent a560489 commit 5072a8e8862e6f07e5fba5d3a1603a673bf1774a
Showing with 9 additions and 5 deletions.
  1. +8 −4 lib/httpclient.rb
  2. +1 −1 sample/ssl/webrick_httpsd.rb
View
@@ -1,5 +1,5 @@
# HTTPClient - HTTP client library.
-# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000-2008 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -83,7 +83,9 @@ class HTTPClient
module Util
def urify(uri)
- if uri.is_a?(URI)
+ if uri.nil?
+ nil
+ elsif uri.is_a?(URI)
uri
else
URI.parse(uri.to_s)
@@ -461,8 +463,10 @@ def reset_challenge
end
def set(uri, user, passwd)
- uri = Util.uri_dirname(uri)
- @auth[uri] = [user, passwd]
+ if uri
+ uri = Util.uri_dirname(uri)
+ @auth[uri] = [user, passwd]
+ end
end
# send cred only when a given uri is;
@@ -14,7 +14,7 @@
cert = OpenSSL::X509::Certificate.new(data)
s = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0",
+ :BindAddress => "localhost",
:Port => $OPT_p.to_i,
:Logger => nil,
:DocumentRoot => $OPT_r || File::join(dir, "/htdocs"),

0 comments on commit 5072a8e

Please sign in to comment.