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.
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'em-http-request'
3
- s.version = '0.1.10'
3
+ s.version = '0.1.11'
4
4
  s.date = '2009-03-20'
5
5
  s.summary = 'EventMachine based HTTP Request interface'
6
6
  s.description = s.summary
@@ -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
- else
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]) &&
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: julien51-em-http-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Grigorik