Skip to content

Instantly share code, notes, and snippets.

@perplexes
Created May 25, 2010 15:55
Show Gist options
  • Select an option

  • Save perplexes/413306 to your computer and use it in GitHub Desktop.

Select an option

Save perplexes/413306 to your computer and use it in GitHub Desktop.
# Override http debugging, pipe to STDERR.
# Output:
# <- "POST /watched.xml HTTP/1.1\r\nAccept: */*\r\nConnection: close\r\nContent-Type: application/xml\r\nAuthorization: Basic MzkyZih7219fIUH\r\nContent-Length: 82\r\nHost: xxxxxxxxxxx.com\r\n\r\n"
# <- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"
# -> "HTTP/1.1 422 Unprocessable Entity\r\n"
module ActiveResource
class Connection
def http
http = Net::HTTP.new(@site.host, @site.port)
http.use_ssl = @site.is_a?(URI::HTTPS)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl
#http.read_timeout = @timeout if @timeout # If timeout is not set, the default Net::HTTP timeout (60s) is used.
http.set_debug_output $stderr
http
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment