diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | 287a34ae0dfc23e4158f67cb7783d239f202c368 (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /lib/webrick | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) | |
download | ruby-287a34ae0dfc23e4158f67cb7783d239f202c368.tar.gz |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick')
-rw-r--r-- | lib/webrick/cgi.rb | 26 | ||||
-rw-r--r-- | lib/webrick/config.rb | 2 | ||||
-rw-r--r-- | lib/webrick/httpauth/authenticator.rb | 8 | ||||
-rw-r--r-- | lib/webrick/httpauth/digestauth.rb | 10 | ||||
-rw-r--r-- | lib/webrick/httpauth/userdb.rb | 2 | ||||
-rw-r--r-- | lib/webrick/httpproxy.rb | 6 | ||||
-rw-r--r-- | lib/webrick/httprequest.rb | 2 | ||||
-rw-r--r-- | lib/webrick/httpresponse.rb | 4 | ||||
-rw-r--r-- | lib/webrick/httpserver.rb | 4 | ||||
-rw-r--r-- | lib/webrick/httpservlet/cgihandler.rb | 12 | ||||
-rw-r--r-- | lib/webrick/httpservlet/erbhandler.rb | 6 | ||||
-rw-r--r-- | lib/webrick/httpservlet/filehandler.rb | 6 | ||||
-rw-r--r-- | lib/webrick/httpservlet/prochandler.rb | 8 | ||||
-rw-r--r-- | lib/webrick/httpstatus.rb | 4 | ||||
-rw-r--r-- | lib/webrick/httputils.rb | 8 | ||||
-rw-r--r-- | lib/webrick/log.rb | 2 | ||||
-rw-r--r-- | lib/webrick/server.rb | 2 | ||||
-rw-r--r-- | lib/webrick/ssl.rb | 6 | ||||
-rw-r--r-- | lib/webrick/utils.rb | 6 |
19 files changed, 62 insertions, 62 deletions
diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb index 7114651193..7099d14689 100644 --- a/lib/webrick/cgi.rb +++ b/lib/webrick/cgi.rb @@ -77,7 +77,7 @@ module WEBrick res.set_error(ex) rescue HTTPStatus::Status => ex res.status = ex.code - rescue Exception => ex + rescue Exception => ex @logger.error(ex) res.set_error(ex, true) ensure @@ -122,7 +122,7 @@ module WEBrick include Enumerable private - + def initialize(config, env, stdin, stdout) @config = config @env = env @@ -130,7 +130,7 @@ module WEBrick @body_part = stdin @out_port = stdout @out_port.binmode - + @server_addr = @env["SERVER_ADDR"] || "0.0.0.0" @server_name = @env["SERVER_NAME"] @server_port = @env["SERVER_PORT"] @@ -164,7 +164,7 @@ module WEBrick httpv = @config[:HTTPVersion] return "#{meth} #{url} HTTP/#{httpv}" end - + def setup_header @env.each{|key, value| case key @@ -175,7 +175,7 @@ module WEBrick end } end - + def add_header(hdrname, value) unless value.empty? @header_part << hdrname << ": " << value << CRLF @@ -185,21 +185,21 @@ module WEBrick def input @header_part.eof? ? @body_part : @header_part end - + public - + def peeraddr [nil, @remote_port, @remote_host, @remote_addr] end - + def addr [nil, @server_port, @server_name, @server_addr] end - + def gets(eol=LF, size=nil) input.gets(eol, size) end - + def read(size=nil) input.read(size) end @@ -211,7 +211,7 @@ module WEBrick def eof? input.eof? end - + def <<(data) @out_port << data end @@ -256,5 +256,5 @@ module WEBrick end end end - end -end + end +end diff --git a/lib/webrick/config.rb b/lib/webrick/config.rb index 121669c13a..946312e915 100644 --- a/lib/webrick/config.rb +++ b/lib/webrick/config.rb @@ -83,7 +83,7 @@ module WEBrick } DigestAuth = { - :Algorithm => 'MD5-sess', # or 'MD5' + :Algorithm => 'MD5-sess', # or 'MD5' :Domain => nil, # an array includes domain names. :Qop => [ 'auth' ], # 'auth' or 'auth-int' or both. :UseOpaque => true, diff --git a/lib/webrick/httpauth/authenticator.rb b/lib/webrick/httpauth/authenticator.rb index f90d1bf75b..d93f12a97a 100644 --- a/lib/webrick/httpauth/authenticator.rb +++ b/lib/webrick/httpauth/authenticator.rb @@ -25,7 +25,7 @@ module WEBrick unless config[sym] raise ArgumentError, "Argument #{sym.inspect} missing." end - } + } @realm = config[:Realm] @userdb = config[:UserDB] @logger = config[:Logger] || Log::new($stderr) @@ -40,8 +40,8 @@ module WEBrick def check_scheme(req) unless credentials = req[@request_field] error("no credentials in the request.") - return nil - end + return nil + end unless match = /^#{@auth_scheme}\s+/i.match(credentials) error("invalid scheme in %s.", credentials) info("%s: %s", @request_field, credentials) if $DEBUG @@ -60,7 +60,7 @@ module WEBrick if @logger.error? log(:error, fmt, *args) end - end + end def info(fmt, *args) if @logger.info? diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb index eec064ca26..aac87a06df 100644 --- a/lib/webrick/httpauth/digestauth.rb +++ b/lib/webrick/httpauth/digestauth.rb @@ -118,16 +118,16 @@ module WEBrick } if !check_uri(req, auth_req) - raise HTTPStatus::BadRequest + raise HTTPStatus::BadRequest end - if auth_req['realm'] != @realm + if auth_req['realm'] != @realm error('%s: realm unmatch. "%s" for "%s"', auth_req['username'], auth_req['realm'], @realm) return false end - auth_req['algorithm'] ||= 'MD5' + auth_req['algorithm'] ||= 'MD5' if auth_req['algorithm'] != @algorithm && (@opera_hack && auth_req['algorithm'] != @algorithm.upcase) error('%s: algorithm unmatch. "%s" for "%s"', @@ -230,7 +230,7 @@ module WEBrick def split_param_value(string) ret = {} while string.bytesize != 0 - case string + case string when /^\s*([\w\-\.\*\%\!]+)=\s*\"((\\.|[^\"])*)\"\s*,?/ key = $1 matched = $2 @@ -320,7 +320,7 @@ module WEBrick uri = auth_req['uri'] if uri != req.request_uri.to_s && uri != req.unparsed_uri && (@internet_explorer_hack && uri != req.path) - error('%s: uri unmatch. "%s" for "%s"', auth_req['username'], + error('%s: uri unmatch. "%s" for "%s"', auth_req['username'], auth_req['uri'], req.request_uri.to_s) return false end diff --git a/lib/webrick/httpauth/userdb.rb b/lib/webrick/httpauth/userdb.rb index 33e01405f4..0285f89352 100644 --- a/lib/webrick/httpauth/userdb.rb +++ b/lib/webrick/httpauth/userdb.rb @@ -18,7 +18,7 @@ module WEBrick def set_passwd(realm, user, pass) self[user] = pass - end + end def get_passwd(realm, user, reload_db=false) # reload_db is dummy diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb index f35a177777..ce99c55d8f 100644 --- a/lib/webrick/httpproxy.rb +++ b/lib/webrick/httpproxy.rb @@ -64,7 +64,7 @@ module WEBrick def proxy_service(req, res) # Proxy Authentication - proxy_auth(req, res) + proxy_auth(req, res) begin self.send("do_#{req.request_method}", req, res) @@ -81,7 +81,7 @@ module WEBrick handler.call(req, res) end end - + def do_CONNECT(req, res) # Proxy Authentication proxy_auth(req, res) @@ -264,7 +264,7 @@ module WEBrick http = Net::HTTP.new(uri.host, uri.port, upstream.host, upstream.port) http.start do if @config[:ProxyTimeout] - ################################## these issues are + ################################## these issues are http.open_timeout = 30 # secs # necessary (maybe bacause http.read_timeout = 60 # secs # Ruby's bug, but why?) ################################## diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 3a8d744016..ff9b6d7849 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -304,7 +304,7 @@ module WEBrick end elsif self['content-length'] || @remaining_size @remaining_size ||= self['content-length'].to_i - while @remaining_size > 0 + while @remaining_size > 0 sz = [@buffer_size, @remaining_size].min break unless buf = read_data(socket, sz) @remaining_size -= buf.bytesize diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 740a8fe921..98c4a357fa 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -201,10 +201,10 @@ module WEBrick def set_error(ex, backtrace=false) case ex - when HTTPStatus::Status + when HTTPStatus::Status @keep_alive = false if HTTPStatus::error?(ex.code) self.status = ex.code - else + else @keep_alive = false self.status = HTTPStatus::RC_INTERNAL_SERVER_ERROR end diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb index 495be263b3..929d856a4a 100644 --- a/lib/webrick/httpserver.rb +++ b/lib/webrick/httpserver.rb @@ -36,12 +36,12 @@ module WEBrick [ $stderr, AccessLog::REFERER_LOG_FORMAT ] ] end - + @virtual_hosts = Array.new end def run(sock) - while true + while true res = HTTPResponse.new(@config) req = HTTPRequest.new(@config) server = self diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb index f504f4d63b..ab36b906f1 100644 --- a/lib/webrick/httpservlet/cgihandler.rb +++ b/lib/webrick/httpservlet/cgihandler.rb @@ -1,11 +1,11 @@ -# +# # cgihandler.rb -- CGIHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: cgihandler.rb,v 1.27 2003/03/21 19:56:01 gotoyuzo Exp $ require 'rbconfig' @@ -68,16 +68,16 @@ module WEBrick if errmsg.bytesize > 0 @logger.error("CGIHandler: #{@script_filename}:\n" + errmsg) end - end + end cgi_err.close(true) end - + if status != 0 @logger.error("CGIHandler: #{@script_filename} exit with #{status}") end data = "" unless data - raw_header, body = data.split(/^[\xd\xa]+/, 2) + raw_header, body = data.split(/^[\xd\xa]+/, 2) raise HTTPStatus::InternalServerError, "Premature end of script headers: #{@script_filename}" if body.nil? diff --git a/lib/webrick/httpservlet/erbhandler.rb b/lib/webrick/httpservlet/erbhandler.rb index 49792193ba..845db07169 100644 --- a/lib/webrick/httpservlet/erbhandler.rb +++ b/lib/webrick/httpservlet/erbhandler.rb @@ -1,11 +1,11 @@ -# +# # erbhandler.rb -- ERBHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: erbhandler.rb,v 1.25 2003/02/24 19:25:31 gotoyuzo Exp $ require 'webrick/httpservlet/abstract.rb' diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index f1cc88bed9..1cac0cabe3 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -32,7 +32,7 @@ module WEBrick if not_modified?(req, res, mtime, res['etag']) res.body = '' raise HTTPStatus::NotModified - elsif req['range'] + elsif req['range'] make_partial_content(req, res, @local_path, st.size) raise HTTPStatus::PartialContent else @@ -402,7 +402,7 @@ module WEBrick res.body << "<A HREF=\"?M=#{d1}\">Last modified</A> " res.body << "<A HREF=\"?S=#{d1}\">Size</A>\n" res.body << "<HR>\n" - + list.unshift [ "..", File::mtime(local_path+"/.."), -1 ] list.each{ |name, time, size| if name == ".." @@ -420,7 +420,7 @@ module WEBrick } res.body << "</PRE><HR>" - res.body << <<-_end_of_html_ + res.body << <<-_end_of_html_ <ADDRESS> #{HTMLUtils::escape(@config[:ServerSoftware])}<BR> at #{req.host}:#{req.port} diff --git a/lib/webrick/httpservlet/prochandler.rb b/lib/webrick/httpservlet/prochandler.rb index 783cb27896..2be3c854c1 100644 --- a/lib/webrick/httpservlet/prochandler.rb +++ b/lib/webrick/httpservlet/prochandler.rb @@ -1,11 +1,11 @@ -# +# # prochandler.rb -- ProcHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: prochandler.rb,v 1.7 2002/09/21 12:23:42 gotoyuzo Exp $ require 'webrick/httpservlet/abstract.rb' @@ -16,7 +16,7 @@ module WEBrick class ProcHandler < AbstractServlet def get_instance(server, *options) self - end + end def initialize(proc) @proc = proc diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb index a4b42f5a90..d022ddb446 100644 --- a/lib/webrick/httpstatus.rb +++ b/lib/webrick/httpstatus.rb @@ -19,7 +19,7 @@ module WEBrick class Error < Status; end class ClientError < Error; end class ServerError < Error; end - + class EOFError < StandardError; end StatusMessage = { @@ -84,7 +84,7 @@ module WEBrick class #{err_name} < #{parent} def self.code() RC_#{var_name} end def self.reason_phrase() StatusMessage[code] end - def code() self::class::code end + def code() self::class::code end def reason_phrase() self::class::reason_phrase end alias to_i code end diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb index f921364786..bed24e09dd 100644 --- a/lib/webrick/httputils.rb +++ b/lib/webrick/httputils.rb @@ -98,7 +98,7 @@ module WEBrick next if /^#/ =~ line line.chomp! mimetype, ext0 = line.split(/\s+/, 2) - next unless ext0 + next unless ext0 next if ext0.empty? ext0.split(/\s+/).each{ |ext| hash[ext] = mimetype } } @@ -216,7 +216,7 @@ module WEBrick super("") else @raw_header = EmptyRawHeader - @header = EmptyHeader + @header = EmptyHeader super(args.shift) unless args.empty? @next_data = self.class.new(*args) @@ -250,7 +250,7 @@ module WEBrick def append_data(data) tmp = self while tmp - unless tmp.next_data + unless tmp.next_data tmp.next_data = data break end @@ -317,7 +317,7 @@ module WEBrick if form_data.has_key?(key) form_data[key].append_data(data) else - form_data[key] = data + form_data[key] = data end end data = FormData.new diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb index 5d4fd0a174..0ffa12dd96 100644 --- a/lib/webrick/log.rb +++ b/lib/webrick/log.rb @@ -72,7 +72,7 @@ module WEBrick end class Log < BasicLog - attr_accessor :time_format + attr_accessor :time_format def initialize(log_file=nil, level=nil) super(log_file, level) diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb index d0b6f2b693..c4d23bd67b 100644 --- a/lib/webrick/server.rb +++ b/lib/webrick/server.rb @@ -157,7 +157,7 @@ module WEBrick begin sock = svr.accept sock.sync = true - Utils::set_non_blocking(sock) + Utils::set_non_blocking(sock) Utils::set_close_on_exec(sock) rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINVAL => ex diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb index 03bfdf4aa0..896206b483 100644 --- a/lib/webrick/ssl.rb +++ b/lib/webrick/ssl.rb @@ -2,7 +2,7 @@ # ssl.rb -- SSL/TLS enhancement for GenericServer # # Copyright (c) 2003 GOTOU Yuuzou All rights reserved. -# +# # $Id$ require 'webrick' @@ -41,7 +41,7 @@ module WEBrick case p when 0; $stderr.putc "." # BN_generate_prime when 1; $stderr.putc "+" # BN_generate_prime - when 2; $stderr.putc "*" # searching good prime, + when 2; $stderr.putc "*" # searching good prime, # n = #of try, # but also data from BN_generate_prime when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q, @@ -88,7 +88,7 @@ module WEBrick if @config[:SSLEnable] unless ssl_context @ssl_context = setup_ssl_context(@config) - @logger.info("\n" + @config[:SSLCertificate].to_text) + @logger.info("\n" + @config[:SSLCertificate].to_text) end listeners.collect!{|svr| ssvr = ::OpenSSL::SSL::SSLServer.new(svr, ssl_context) diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index f2ecfc19a8..dee9363441 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -86,13 +86,13 @@ module WEBrick RAND_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + - "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz" def random_string(len) rand_max = RAND_CHARS.bytesize - ret = "" + ret = "" len.times{ ret << RAND_CHARS[rand(rand_max)] } - ret + ret end module_function :random_string |