FrontPage  Index  Search  Changes  PageRank  RSS  Login

ibis's Wiki - (Ruby)http-access2 Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

<<<
# DESCRIPTION
#   HTTPAccess2::Client -- Client to retrieve web resources via HTTP.
#
# How to create your client.
#   1. Create simple client.
#     clnt = HTTPAccess2::Client.new
#
#   2. Accessing resources through HTTP proxy.
#     clnt = HTTPAccess2::Client.new("http://myproxy:8080")
#
#   3. Set User-Agent and From in HTTP request header.(nil means "No proxy")
#     clnt = HTTPAccess2::Client.new(nil, "MyAgent", "nahi@keynauts.com")
#
# How to retrieve web resources.
#   1. Get content of specified URL.
#     puts clnt.get_content("http://www.ruby-lang.org/en/")
#
#   2. Do HEAD request.
#     res = clnt.head(uri)
#
#   3. Do GET request with query.
#     res = clnt.get(uri)
#
#   4. Do POST request.
#     res = clnt.post(uri)
#     res = clnt.get|post|head(uri, proxy)
#
>>>

<<<
  # SYNOPSIS
  #   Client.new(proxy = nil, agent_name = nil, from = nil)
  #
  # ARGS
  #   proxy A String of HTTP proxy URL. ex. "http://proxy:8080".
  #   agent_name A String for "User-Agent" HTTP request header.
  #   from A String for "From" HTTP request header.
  #
  # DESCRIPTION
  #   Create an instance.
  #   SSLConfig cannot be re-initialized.  Create new client.
  #
>>>

<<<
  # SYNOPSIS
  #   Client#get_content(uri, query = nil, extheader = {}, &block = nil)
  #
  # ARGS
  #   uri an_URI or a_string of uri to connect.
  #   query a_hash or an_array of query part.  e.g. { "a" => "b" }.
  #   Give an array to pass multiple value like
  #   [["a" => "b"], ["a" => "c"]].
  #   extheader
  #   a_hash of extra headers like { "SOAPAction" => "urn:foo" }.
  #   &block Give a block to get chunked message-body of response like
  #   get_content(uri) { |chunked_body| ... }
  #   Size of each chunk may not be the same.
  #
  # DESCRIPTION
  #   Get a_sring of message-body of response.
  #
>>>

*HTTP::Message::Headers
!!accessor
**http_version
**body_type
**body_charset
**body_date
**reason_phrase
**request_via_proxy
!!reader
**body_size
**chunked
**request_method
**request_uri
**response_status_code

**contenttype

*HTTP::Message::Body
!!accessor
**type
**charset
**date
**chunk_size

**dump
**content

*content
**@body.content
*body
**@body
*status
*version
*reason
*contenttype