julien51-em-http-request 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/em-http-request.gemspec +1 -1
 - data/lib/em-http/client.rb +5 -2
 - data/lib/em-http/request.rb +2 -0
 - metadata +1 -1
 
    
        data/em-http-request.gemspec
    CHANGED
    
    
    
        data/lib/em-http/client.rb
    CHANGED
    
    | 
         @@ -333,7 +333,6 @@ module EventMachine 
     | 
|
| 
       333 
333 
     | 
    
         | 
| 
       334 
334 
     | 
    
         
             
                def parse_header(header)
         
     | 
| 
       335 
335 
     | 
    
         
             
                  return false if @data.empty?
         
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
336 
     | 
    
         
             
                  begin
         
     | 
| 
       338 
337 
     | 
    
         
             
                    @parser_nbytes = @parser.execute(header, @data.to_str, @parser_nbytes)
         
     | 
| 
       339 
338 
     | 
    
         
             
                  rescue EventMachine::HttpClientParserError
         
     | 
| 
         @@ -368,7 +367,7 @@ module EventMachine 
     | 
|
| 
       368 
367 
     | 
    
         | 
| 
       369 
368 
     | 
    
         
             
                  if @response_header.chunked_encoding?
         
     | 
| 
       370 
369 
     | 
    
         
             
                    @state = :chunk_header
         
     | 
| 
       371 
     | 
    
         
            -
                   
     | 
| 
      
 370 
     | 
    
         
            +
                  elsif @response_header.content_length
         
     | 
| 
       372 
371 
     | 
    
         
             
                    if @response_header.content_length > 0
         
     | 
| 
       373 
372 
     | 
    
         
             
                      @state = :body
         
     | 
| 
       374 
373 
     | 
    
         
             
                      @bytes_remaining = @response_header.content_length 
         
     | 
| 
         @@ -376,6 +375,10 @@ module EventMachine 
     | 
|
| 
       376 
375 
     | 
    
         
             
                      @state = :finished
         
     | 
| 
       377 
376 
     | 
    
         
             
                      on_request_complete
         
     | 
| 
       378 
377 
     | 
    
         
             
                    end
         
     | 
| 
      
 378 
     | 
    
         
            +
                  else
         
     | 
| 
      
 379 
     | 
    
         
            +
                    @state = :invalid
         
     | 
| 
      
 380 
     | 
    
         
            +
                    on_error "no HTTP response"
         
     | 
| 
      
 381 
     | 
    
         
            +
                    return false
         
     | 
| 
       379 
382 
     | 
    
         
             
                  end
         
     | 
| 
       380 
383 
     | 
    
         | 
| 
       381 
384 
     | 
    
         
             
                  if @inflate.include?(response_header[CONTENT_ENCODING]) &&
         
     | 
    
        data/lib/em-http/request.rb
    CHANGED
    
    | 
         @@ -61,6 +61,8 @@ module EventMachine 
     | 
|
| 
       61 
61 
     | 
    
         
             
                  method = method.to_s.upcase
         
     | 
| 
       62 
62 
     | 
    
         
             
                  begin
         
     | 
| 
       63 
63 
     | 
    
         
             
                   host = options[:host] || @uri.host
         
     | 
| 
      
 64 
     | 
    
         
            +
                   raise ArgumentError, "invalid host" unless host
         
     | 
| 
      
 65 
     | 
    
         
            +
                   raise ArgumentError, "invalid port" unless @uri.port
         
     | 
| 
       64 
66 
     | 
    
         
             
                   EventMachine.connect(host, @uri.port, EventMachine::HttpClient) { |c|
         
     | 
| 
       65 
67 
     | 
    
         
             
                      c.uri = @uri
         
     | 
| 
       66 
68 
     | 
    
         
             
                      c.method = method
         
     |