Class: Net::HTTPGenericRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/s33r/s33r_http.rb

Overview

Modification of Net::HTTP base class to enable larger chunk sizes to be used when streaming data from large files.

N.B. does not alter the behaviour of this class unless you set chunk_size using the accessor.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#chunk_sizeObject

Size of chunks (in bytes) to send when streaming body data.



51
52
53
# File 'lib/s33r/s33r_http.rb', line 51

def chunk_size
  @chunk_size
end

Instance Method Details

#to_sObject

Dump initial line and raw request headers (useful for visual debugging).

Switch on request debugging by passing :dump_requests => true to S33r::Client constructor.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/s33r/s33r_http.rb', line 57

def to_s
  str = "*******\n" +
  "#{self.class::METHOD} #{@path} HTTP/1.1\n" +
  "Host: #{S33r::HOST}\n"

  self.each_capitalized do |key, value|
    str += "#{key}: #{value}\n"
  end
  str += "*******\n" + body + "\n" unless body.nil?
  str += "*******\n\n"
  str
end