Created
June 4, 2012 09:56
-
-
Save phlegx/2867548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = URI.parse('https://cm.example.com/balancer-manager') | |
req = Net::HTTP::Post.new(url.path) | |
req.basic_auth '[email protected]', 'pass' | |
req.set_form_data({'status_D' => '1'}) | |
resp = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } | |
puts resp | |
## Error: ------------------------------------------------------------------------- | |
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2221:in `read_status_line': wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" (Net::HTTPBadResponse) | |
from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:2208:in `read_new' | |
from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request' | |
from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:1177:in `request' | |
from ./balancer-manager.rb:15:in `block in <main>' | |
from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/net/http.rb:627:in `start' | |
from ./balancer-manager.rb:15:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment