Sha256: c4a587c068041a34617e2336b84850ed70c249ccfd5bc5ed8ab39b0148b7874c
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
require 'net/http' class Net::HTTPResponse attr_accessor :success def ok? success end def success response.is_a?(Net::HTTPOK) end def to_s body end end class Net::HTTPGenericRequest attr_accessor :chunk_size private def send_request_with_body_stream(sock, ver, path, f) raise ArgumentError, "Content-Length not given and Transfer-Encoding is not `chunked'" unless content_length() or chunked? unless content_type() warn 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE set_content_type 'application/x-www-form-urlencoded' end @chunk_size ||= 1024 write_header sock, ver, path if chunked? while s = f.read(@chunk_size) sock.write(sprintf("%x\r\n", s.length) << s << "\r\n") end sock.write "0\r\n\r\n" else while s = f.read(@chunk_size) sock.write s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
s33r-0.1 | lib/s33r/net_http_overrides.rb |