Class Patron::Session
In: lib/patron/session.rb
Parent: Object

This class represents multiple request/response transactions with an HTTP server. This is the primary API for Patron.

Methods

copy   delete   enable_debug   get   get_file   handle_cookies   head   new   post   post_file   post_multipart   put   put_file   request  

Attributes

auth_type  [RW]  Set the authentication type for the request. @see Patron::Request#auth_type
base_url  [RW]  Prepended to the URL in all requests.
buffer_size  [RW]  Set the buffer size for this request. This option will only be set if buffer_size is non-nil
connect_timeout  [RW]  HTTP connection timeout in seconds. Defaults to 1 second.
headers  [R]  Standard set of headers that are used in all requests.
insecure  [RW]  Does this session stricly verify SSL certificates?
max_redirects  [RW]  Maximum number of times to follow redirects. Set to 0 to disable and -1 to follow all redirects. Defaults to 5.
password  [RW]  Username and password for http authentication
proxy  [RW]  Proxy URL in cURL format (‘hostname:8080’)
proxy_type  [RW]  Proxy type (default is HTTP), see constants under ProxyType for supported types.
timeout  [RW]  HTTP transaction timeout in seconds. Defaults to 5 seconds.
username  [RW]  Username and password for http authentication

Public Class methods

Create a new Session object.

Public Instance methods

Sends a WebDAV COPY request to the specified url.

As get but sends an HTTP DELETE request.

Enable debug output to stderr or to specified file.

Retrieve the contents of the specified url optionally sending the specified headers. If the base_url varaible is set then it is prepended to the url parameter. Any custom headers are merged with the contents of the headers instance variable. The results are returned in a Response object.

Retrieve the contents of the specified url as with get, but the content at the URL is downloaded directly into the specified file.

Turn on cookie handling for this session, storing them in memory by default or in file if specified. The file must be readable and writable. Calling multiple times will add more files.

As get but sends an HTTP HEAD request.

Uploads the passed data to the specified url using HTTP POST. data must be a string.

Uploads the contents of a file to the specified url using HTTP POST.

Uploads the contents of a file and data to the specified url using HTTP POST.

Uploads the passed data to the specified url using HTTP PUT. data must be a string.

Uploads the contents of a file to the specified url using HTTP PUT.

Send an HTTP request to the specified url.

[Validate]