ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/README
(Generate patch)

Comparing AnyEvent-HTTP/README (file contents):
Revision 1.8 by root, Tue Jul 7 00:15:32 2009 UTC vs.
Revision 1.10 by root, Wed Aug 5 16:43:47 2009 UTC

90 90
91 headers => hashref 91 headers => hashref
92 The request headers to use. Currently, "http_request" may 92 The request headers to use. Currently, "http_request" may
93 provide its own "Host:", "Content-Length:", "Connection:" and 93 provide its own "Host:", "Content-Length:", "Connection:" and
94 "Cookie:" headers and will provide defaults for "User-Agent:" 94 "Cookie:" headers and will provide defaults for "User-Agent:"
95 and "Referer:". 95 and "Referer:" (this can be suppressed by using "undef" for
96 these headers in which case they won't be sent at all).
96 97
97 timeout => $seconds 98 timeout => $seconds
98 The time-out to use for various stages - each connect attempt 99 The time-out to use for various stages - each connect attempt
99 will reset the timeout, as will read or write activity. Default 100 will reset the timeout, as will read or write activity. Default
100 timeout is 5 minutes. 101 timeout is 5 minutes.
102 proxy => [$host, $port[, $scheme]] or undef 103 proxy => [$host, $port[, $scheme]] or undef
103 Use the given http proxy for all requests. If not specified, 104 Use the given http proxy for all requests. If not specified,
104 then the default proxy (as specified by $ENV{http_proxy}) is 105 then the default proxy (as specified by $ENV{http_proxy}) is
105 used. 106 used.
106 107
107 $scheme must be either missing or "http" for HTTP, or "https" 108 $scheme must be either missing, "http" for HTTP or "https" for
108 for HTTPS. 109 HTTPS.
109 110
110 body => $string 111 body => $string
111 The request body, usually empty. Will be-sent as-is (future 112 The request body, usually empty. Will be-sent as-is (future
112 versions of this module might offer more options). 113 versions of this module might offer more options).
113 114
174 memory (so the callback writes it to a file) or when only some 175 memory (so the callback writes it to a file) or when only some
175 information should be extracted, or when the body should be 176 information should be extracted, or when the body should be
176 processed incrementally. 177 processed incrementally.
177 178
178 It is usually preferred over doing your own body handling via 179 It is usually preferred over doing your own body handling via
179 "want_body_handle". 180 "want_body_handle", but in case of streaming APIs, where HTTP is
181 only used to create a connection, "want_body_handle" is the
182 better alternative, as it allows you to install your own event
183 handler, reducing resource usage.
180 184
181 want_body_handle => $enable 185 want_body_handle => $enable
182 When enabled (default is disabled), the behaviour of 186 When enabled (default is disabled), the behaviour of
183 AnyEvent::HTTP changes considerably: after parsing the headers, 187 AnyEvent::HTTP changes considerably: after parsing the headers,
184 and instead of downloading the body (if any), the completion 188 and instead of downloading the body (if any), the completion
197 initial headers, an interactive protocol is used (typical 201 initial headers, an interactive protocol is used (typical
198 example would be the push-style twitter API which starts a 202 example would be the push-style twitter API which starts a
199 JSON/XML stream). 203 JSON/XML stream).
200 204
201 If you think you need this, first have a look at "on_body", to 205 If you think you need this, first have a look at "on_body", to
202 see if that doesn'T solve your problem in a better way. 206 see if that doesn't solve your problem in a better way.
203 207
204 Example: make a simple HTTP GET request for http://www.nethype.de/ 208 Example: make a simple HTTP GET request for http://www.nethype.de/
205 209
206 http_request GET => "http://www.nethype.de/", sub { 210 http_request GET => "http://www.nethype.de/", sub {
207 my ($body, $hdr) = @_; 211 my ($body, $hdr) = @_;
243 The default value for the "User-Agent" header (the default is 247 The default value for the "User-Agent" header (the default is
244 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; 248 "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION;
245 +http://software.schmorp.de/pkg/AnyEvent)"). 249 +http://software.schmorp.de/pkg/AnyEvent)").
246 250
247 $AnyEvent::HTTP::MAX_PER_HOST 251 $AnyEvent::HTTP::MAX_PER_HOST
248 The maximum number of concurrent conenctions to the same host 252 The maximum number of concurrent connections to the same host
249 (identified by the hostname). If the limit is exceeded, then the 253 (identified by the hostname). If the limit is exceeded, then the
250 additional requests are queued until previous connections are 254 additional requests are queued until previous connections are
251 closed. 255 closed.
252 256
253 The default value for this is 4, and it is highly advisable to not 257 The default value for this is 4, and it is highly advisable to not

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines