mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#do_CONNECT):
use #bytesize instead of #size. a patch submitted from raspberry lemon in [ruby-core:18571]. * lib/webrick/httpauth/digestauth.rb, lib/webrick/httpproxy.rb, lib/webrick/httprequest.rb, lib/webrick/httpservlet/cgi_runner.rb, lib/webrick/httpservlet/abstract.rb, lib/webrick/httpresponse.rb, lib/webrick/httpservlet/cgihandler.rb, lib/webrick/utils.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									75fcee4a23
								
							
						
					
					
						commit
						877ac7236a
					
				
					 10 changed files with 37 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -142,7 +142,7 @@ module WEBrick
 | 
			
		|||
        @header.delete('content-length')
 | 
			
		||||
      elsif @header['content-length'].nil?
 | 
			
		||||
        unless @body.is_a?(IO)
 | 
			
		||||
          @header['content-length'] = @body ? @body.size : 0
 | 
			
		||||
          @header['content-length'] = @body ? @body.bytesize : 0
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -260,10 +260,10 @@ module WEBrick
 | 
			
		|||
          while buf = @body.read(@buffer_size)
 | 
			
		||||
            next if buf.empty?
 | 
			
		||||
            data = ""
 | 
			
		||||
            data << format("%x", buf.size) << CRLF
 | 
			
		||||
            data << format("%x", buf.bytesize) << CRLF
 | 
			
		||||
            data << buf << CRLF
 | 
			
		||||
            _write_data(socket, data)
 | 
			
		||||
            @sent_size += buf.size
 | 
			
		||||
            @sent_size += buf.bytesize
 | 
			
		||||
          end
 | 
			
		||||
          _write_data(socket, "0#{CRLF}#{CRLF}")
 | 
			
		||||
        else
 | 
			
		||||
| 
						 | 
				
			
			@ -280,20 +280,20 @@ module WEBrick
 | 
			
		|||
      if @request_method == "HEAD"
 | 
			
		||||
        # do nothing
 | 
			
		||||
      elsif chunked?
 | 
			
		||||
        remain = body ? @body.size : 0
 | 
			
		||||
        remain = body ? @body.bytesize : 0
 | 
			
		||||
        while buf = @body[@sent_size, @buffer_size]
 | 
			
		||||
          break if buf.empty?
 | 
			
		||||
          data = ""
 | 
			
		||||
          data << format("%x", buf.size) << CRLF
 | 
			
		||||
          data << format("%x", buf.bytesize) << CRLF
 | 
			
		||||
          data << buf << CRLF
 | 
			
		||||
          _write_data(socket, data)
 | 
			
		||||
          @sent_size += buf.size
 | 
			
		||||
          @sent_size += buf.bytesize
 | 
			
		||||
        end
 | 
			
		||||
        _write_data(socket, "0#{CRLF}#{CRLF}")
 | 
			
		||||
      else
 | 
			
		||||
        if @body && @body.size > 0
 | 
			
		||||
        if @body && @body.bytesize > 0
 | 
			
		||||
          _write_data(socket, @body)
 | 
			
		||||
          @sent_size = @body.size
 | 
			
		||||
          @sent_size = @body.bytesize
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -302,7 +302,7 @@ module WEBrick
 | 
			
		|||
      while offset > 0
 | 
			
		||||
        sz = @buffer_size < size ? @buffer_size : size
 | 
			
		||||
        buf = input.read(sz)
 | 
			
		||||
        offset -= buf.size
 | 
			
		||||
        offset -= buf.bytesize
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      if size == 0
 | 
			
		||||
| 
						 | 
				
			
			@ -314,7 +314,7 @@ module WEBrick
 | 
			
		|||
          sz = @buffer_size < size ? @buffer_size : size
 | 
			
		||||
          buf = input.read(sz)
 | 
			
		||||
          _write_data(output, buf)
 | 
			
		||||
          size -= buf.size
 | 
			
		||||
          size -= buf.bytesize
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue