#7 √ resolved
franxxk

Manage HTTP proxy

Reported by franxxk | August 12th, 2008 @ 04:41 AM

Add a feature to manage http proxy, like basic auth...


class MyClass
  include HTTParty
  format :xml
  http_proxy http_addr, http_port
...

What i have test (that's works, unable to update git - no loign :-) )


 module ClassMethods
    def http_proxy(addr=nil, port = nil)
	   @http_proxyaddr = addr
	   @http_proxyport = port
    end
....
 private
      def http(uri) #:nodoc:
        if @http.blank?
          @http = Net::HTTP.new(uri.host, uri.port, @http_proxyaddr, @http_proxyport)

....

Comments and changes to this ticket

  • John Nunemaker

    John Nunemaker August 22nd, 2008 @ 09:57 PM

    • → State changed from “new” to “resolved”

    (from [b0f1cc2a8d6ab02f2fc7485ad3c25b87319443e4]) Raises exception when http error occurs. Added http_proxy key for setting proxy server and port. [#3 state:resolved] [#7 state:resolved] http://github.com/jnunemaker/htt...

  • benaldred

    benaldred September 10th, 2008 @ 07:26 AM

    Just a quick note on this feature, I was getting the following error when it was setting up the Net::HTTP object:

    SocketError (getaddrinfo: nodename nor servname provided, or not known):

    This was because I followed the documentation and included protocol in the proxy address.

    It was fine when I dropped the protocol. I think the documentation needs changing to avoid confusion.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets for the HTTParty ruby gem.

People watching this ticket

Tags