--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "WebAgent::CookieManager:"
      body: Cookies configurator.
    type: :NOTE
  name: cookie_manager
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: How many times get_content and post_content follows HTTP redirect. 10 by default.
  name: follow_redirect_count
  rw: RW
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "HTTPClient::ProxyAuth:"
      body: Proxy authentication handler.
    type: :NOTE
  name: proxy_auth
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: An array of request filter which can trap HTTP request/response. See HTTPClient::WWWAuth to see how to use it.
  name: request_filter
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "HTTPClient::SSLConfig:"
      body: SSL configurator.
    type: :NOTE
  name: ssl_config
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: An array of response HTTP message body String which is used for loop-back test. See test/* to see how to use it. If you want to do loop-back test of HTTP header, use test_loopback_http_response instead.
  name: test_loopback_response
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "HTTPClient::WWWAuth:"
      body: WWW authentication handler.
    type: :NOTE
  name: www_auth
  rw: R
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: new
- !ruby/object:RI::MethodSummary 
  name: timeout_scheduler
comment: 
- !ruby/struct:SM::Flow::P 
  body: The HTTPClient class provides several methods for accessing Web resources via HTTP.
- !ruby/struct:SM::Flow::P 
  body: HTTPClient instance is designed to be MT-safe. You can call a HTTPClient instance from several threads without synchronization after setting up an instance.
- !ruby/struct:SM::Flow::VERB 
  body: "  clnt = HTTPClient.new\n  clnt.set_cookie_store('/home/nahi/cookie.dat')\n  urls.each do |url|\n    Thread.new(url) do |u|\n      p clnt.head(u).status\n    end\n  end\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: How to use
- !ruby/struct:SM::Flow::P 
  body: At first, how to create your client. See initialize for more detail.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Create simple client.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Accessing resources through HTTP proxy. You can use environment variable 'http_proxy' or 'HTTP_PROXY' instead.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new('http://myproxy:8080')\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: How to retrieve web resources
- !ruby/struct:SM::Flow::P 
  body: See get_content.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Get content of specified URL. It returns a String of whole result.
  - !ruby/struct:SM::Flow::VERB 
    body: " puts clnt.get_content('http://dev.ctor.org/')\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Get content as chunks of String. It yields chunks of String.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt.get_content('http://dev.ctor.org/') do |chunk|\n   puts chunk\n end\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Invoking other HTTP methods
- !ruby/struct:SM::Flow::P 
  body: See head, get, post, put, delete, options, propfind, proppatch and trace. It returns a HTTP::Message instance as a response.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Do HEAD request.
  - !ruby/struct:SM::Flow::VERB 
    body: " res = clnt.head(uri)\n p res.header['Last-Modified'][0]\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Do GET request with query.
  - !ruby/struct:SM::Flow::VERB 
    body: " query = { 'keyword' =&gt; 'ruby', 'lang' =&gt; 'en' }\n res = clnt.get(uri, query)\n p res.status\n p res.contenttype\n p res.header['X-Custom']\n puts res.content\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: How to POST
- !ruby/struct:SM::Flow::P 
  body: See post.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Do POST a form data.
  - !ruby/struct:SM::Flow::VERB 
    body: " body = { 'keyword' =&gt; 'ruby', 'lang' =&gt; 'en' }\n res = clnt.post(uri, body)\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Do multipart file upload with POST. No need to set extra header by yourself from httpclient/2.1.4.
  - !ruby/struct:SM::Flow::VERB 
    body: " File.open('/tmp/post_data') do |file|\n   body = { 'upload' =&gt; file, 'user' =&gt; 'nahi' }\n   res = clnt.post(uri, body)\n end\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Accessing via SSL
- !ruby/struct:SM::Flow::P 
  body: Ruby needs to be compiled with OpenSSL.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Get content of specified URL via SSL. Just pass an URL which starts with 'https://'.
  - !ruby/struct:SM::Flow::VERB 
    body: " https_url = 'https://www.rsa.com'\n clnt.get_content(https_url)\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Getting peer certificate from response.
  - !ruby/struct:SM::Flow::VERB 
    body: " res = clnt.get(https_url)\n p res.peer_cert #=&gt; returns OpenSSL::X509::Certificate\n"
  - !ruby/struct:SM::Flow::LI 
    label: "3."
    body: Configuring OpenSSL options. See HTTPClient::SSLConfig for more details.
  - !ruby/struct:SM::Flow::VERB 
    body: " user_cert_file = 'cert.pem'\n user_key_file = 'privkey.pem'\n clnt.ssl_config.set_client_cert_file(user_cert_file, user_key_file)\n clnt.get_content(https_url)\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Handling Cookies
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Using volatile Cookies. Nothing to do. HTTPClient handles Cookies.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new\n clnt.get_content(url1) # receives Cookies.\n clnt.get_content(url2) # sends Cookies if needed.\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Saving non volatile Cookies to a specified file. Need to set a file at first and invoke save method at last.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new\n clnt.set_cookie_store('/home/nahi/cookie.dat')\n clnt.get_content(url)\n ...\n clnt.save_cookie_store\n"
  - !ruby/struct:SM::Flow::LI 
    label: "3."
    body: Disabling Cookies.
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new\n clnt.cookie_manager = nil\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Configuring authentication credentials
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "1."
    body: Authentication with Web server. Supports BasicAuth, DigestAuth, and Negotiate/NTLM (requires ruby/ntlm module).
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new\n domain = 'http://dev.ctor.org/http-access2/'\n user = 'user'\n password = 'user'\n clnt.set_auth(domain, user, password)\n p clnt.get_content('http://dev.ctor.org/http-access2/login').status\n"
  - !ruby/struct:SM::Flow::LI 
    label: "2."
    body: Authentication with Proxy server. Supports BasicAuth and NTLM (requires win32/sspi)
  - !ruby/struct:SM::Flow::VERB 
    body: " clnt = HTTPClient.new(proxy)\n user = 'proxy'\n password = 'proxy'\n clnt.set_proxy_auth(user, password)\n p clnt.get_content(url)\n"
  type: :NUMBER
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Invoking HTTP methods with custom header
- !ruby/struct:SM::Flow::P 
  body: Pass a Hash or an Array for extheader argument.
- !ruby/struct:SM::Flow::VERB 
  body: "    extheader = { 'Accept' =&gt; '*/*' }\n    clnt.get_content(uri, query, extheader)\n\n    extheader = [['Accept', 'image/jpeg'], ['Accept', 'image/png']]\n    clnt.get_content(uri, query, extheader)\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Invoking HTTP methods asynchronously
- !ruby/struct:SM::Flow::P 
  body: See head_async, get_async, post_async, put_async, delete_async, options_async, propfind_async, proppatch_async, and trace_async. It immediately returns a HTTPClient::Connection instance as a returning value.
- !ruby/struct:SM::Flow::VERB 
  body: "    connection = clnt.post_async(url, body)\n    print 'posting.'\n    while true\n      break if connection.finished?\n      print '.'\n      sleep 1\n    end\n    puts '.'\n    res = connection.pop\n    p res.status\n    p res.content.read # res.content is an IO for the res of async method.\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Shortcut methods
- !ruby/struct:SM::Flow::P 
  body: You can invoke get_content, get, etc. without creating HTTPClient instance.
- !ruby/struct:SM::Flow::VERB 
  body: "  ruby -rhttpclient -e 'puts HTTPClient.get_content(ARGV.shift)' http://dev.ctor.org/\n  ruby -rhttpclient -e 'p HTTPClient.head(ARGV.shift).header[&quot;last-modified&quot;]' http://dev.ctor.org/\n"
constants: 
- !ruby/object:RI::Constant 
  comment: 
  name: NTLMEnabled
  value: "true"
- !ruby/object:RI::Constant 
  comment: 
  name: NTLMEnabled
  value: "false"
- !ruby/object:RI::Constant 
  comment: 
  name: SSPIEnabled
  value: "true"
- !ruby/object:RI::Constant 
  comment: 
  name: SSPIEnabled
  value: "false"
- !ruby/object:RI::Constant 
  comment: 
  name: SSLEnabled
  value: "true"
- !ruby/object:RI::Constant 
  comment: 
  name: SSLEnabled
  value: "false"
- !ruby/object:RI::Constant 
  comment: 
  name: VERSION
  value: "'2.1.4'"
- !ruby/object:RI::Constant 
  comment: 
  name: RUBY_VERSION_STRING
  value: "\"ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]\""
- !ruby/object:RI::Constant 
  comment: 
  name: LIB_NAME
  value: "\"(#{$1}/#{$2}, #{RUBY_VERSION_STRING})\""
- !ruby/object:RI::Constant 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: Default extheader for PROPFIND request.
  name: PROPFIND_DEFAULT_EXTHEADER
  value: "{ 'Depth' => '0' }"
- !ruby/object:RI::Constant 
  comment: 
  name: NO_PROXY_HOSTS
  value: "['localhost']"
full_name: HTTPClient
includes: 
- !ruby/object:RI::IncludedModule 
  name: Util
instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: debug_dev
- !ruby/object:RI::MethodSummary 
  name: debug_dev=
- !ruby/object:RI::MethodSummary 
  name: default_redirect_uri_callback
- !ruby/object:RI::MethodSummary 
  name: delete
- !ruby/object:RI::MethodSummary 
  name: delete_async
- !ruby/object:RI::MethodSummary 
  name: get
- !ruby/object:RI::MethodSummary 
  name: get_async
- !ruby/object:RI::MethodSummary 
  name: get_content
- !ruby/object:RI::MethodSummary 
  name: head
- !ruby/object:RI::MethodSummary 
  name: head_async
- !ruby/object:RI::MethodSummary 
  name: no_proxy
- !ruby/object:RI::MethodSummary 
  name: no_proxy=
- !ruby/object:RI::MethodSummary 
  name: options
- !ruby/object:RI::MethodSummary 
  name: options_async
- !ruby/object:RI::MethodSummary 
  name: post
- !ruby/object:RI::MethodSummary 
  name: post_async
- !ruby/object:RI::MethodSummary 
  name: post_content
- !ruby/object:RI::MethodSummary 
  name: propfind
- !ruby/object:RI::MethodSummary 
  name: propfind_async
- !ruby/object:RI::MethodSummary 
  name: proppatch
- !ruby/object:RI::MethodSummary 
  name: proppatch_async
- !ruby/object:RI::MethodSummary 
  name: proxy
- !ruby/object:RI::MethodSummary 
  name: proxy=
- !ruby/object:RI::MethodSummary 
  name: put
- !ruby/object:RI::MethodSummary 
  name: put_async
- !ruby/object:RI::MethodSummary 
  name: redirect_uri_callback=
- !ruby/object:RI::MethodSummary 
  name: request
- !ruby/object:RI::MethodSummary 
  name: request_async
- !ruby/object:RI::MethodSummary 
  name: reset
- !ruby/object:RI::MethodSummary 
  name: reset_all
- !ruby/object:RI::MethodSummary 
  name: save_cookie_store
- !ruby/object:RI::MethodSummary 
  name: set_auth
- !ruby/object:RI::MethodSummary 
  name: set_basic_auth
- !ruby/object:RI::MethodSummary 
  name: set_cookie_store
- !ruby/object:RI::MethodSummary 
  name: set_proxy_auth
- !ruby/object:RI::MethodSummary 
  name: strict_redirect_uri_callback
- !ruby/object:RI::MethodSummary 
  name: trace
- !ruby/object:RI::MethodSummary 
  name: trace_async
name: HTTPClient
superclass: Object
