Moshe Zadka | 8a18e99 | 2001-03-01 08:40:42 +0000 | [diff] [blame] | 1 | \section{\module{urllib2} --- |
| 2 | extensible library for opening URLs} |
| 3 | |
| 4 | \declaremodule{standard}{urllib2} |
| 5 | |
| 6 | \moduleauthor{Jeremy Hylton}{jhylton@users.sourceforge.net} |
| 7 | \sectionauthor{Moshe Zadka}{moshez@users.sourceforge.net} |
| 8 | |
| 9 | \modulesynopsis{An extensible library for opening URLs using a variety of |
| 10 | protocols} |
| 11 | |
| 12 | The \module{urllib2} module defines functions and classes which help |
| 13 | in opening URLs (mostly HTTP) in a complex world -- basic and digest |
| 14 | authentication, redirections and more. |
| 15 | |
| 16 | The \module{urllib2} module defines the following functions: |
| 17 | |
| 18 | \begin{funcdesc}{urlopen}{url\optional{, data}} |
| 19 | Open the url \var{url}, which can either a string or a \class{Request} |
| 20 | object (currently the code checks that it really is a \class{Request} |
| 21 | instance, or an instance of a subclass of \class{Request}. |
| 22 | |
| 23 | \var{data} should be a string, which specifies additional data to |
| 24 | send to the server. In HTTP requests, which are the only ones that |
| 25 | support \var{data}, it should be a buffer in the format of |
| 26 | \code{application/x-www-form-urlencoded}, for example one returned |
| 27 | from \function{urllib.urlencode}. |
| 28 | |
| 29 | This function returns a file-like object with two additional methods: |
| 30 | |
| 31 | \begin{itemize} |
| 32 | |
| 33 | \item \code{geturl()} --- return the URL of the resource retrieved |
| 34 | \item \code{info()} --- return the meta-information of the page, as |
| 35 | a dictionary-like object |
| 36 | \end{itemize} |
| 37 | |
| 38 | Raises \exception{URLError} on errors. |
| 39 | \end{funcdesc} |
| 40 | |
| 41 | \begin{funcdesc}{install_opener}{opener} |
| 42 | Install a \class{OpenerDirector} instance as the default opener. |
| 43 | The code does not check for a real \class{OpenerDirector}, and any |
| 44 | class with the appropriate interface will work. |
| 45 | \end{funcdesc} |
| 46 | |
| 47 | \begin{funcdesc}{build_opener}{\optional{handler\optional{, |
| 48 | handler\optional{, ...}}}} |
| 49 | Return an \class{OpenerDirector} instance, which chains the |
| 50 | handlers in the order given. \var{handler}s can be either instances |
| 51 | of \class{BaseHandler}, or subclasses of \class{BaseHandler} (in |
| 52 | which case it must be possible to call the constructor without |
| 53 | any parameters. Instances of the following classes will be in |
| 54 | the front of the \var{handler}s, unless the \var{handler}s contain |
| 55 | them, instances of them or subclasses of them: |
| 56 | |
| 57 | \code{ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, |
| 58 | HTTPRedirectHandler, FTPHandler, FileHandler} |
| 59 | |
| 60 | If the Python installation has SSL support (\code{socket.ssl} exists), |
| 61 | \class{HTTPSHandler} will also be added. |
| 62 | \end{funcdesc} |
| 63 | |
| 64 | \begin{excdesc}{URLError} |
| 65 | The error handlers raise when they run into a problem. It is a subclass |
| 66 | of \exception{IOError}. |
| 67 | \end{excdesc} |
| 68 | |
| 69 | \begin{excdesc}{HTTPError} |
| 70 | A subclass of \exception{URLError}, it can also function as a |
| 71 | non-exceptional file-like return value (the same thing that \function{urlopen} |
| 72 | returns). This is useful when handling exotic HTTP errors, such as |
| 73 | requests for authentications. |
| 74 | \end{excdesc} |
| 75 | |
| 76 | \begin{excdesc}{GopherError} |
| 77 | A subclass of \exception{URLError}, this is the error raised by the |
| 78 | Gopher handler. |
| 79 | \end{excdesc} |
| 80 | |
| 81 | \begin{classdesc}{Request}{url\optional{data, \optional{, headers}}} |
| 82 | This class is an abstraction of a URL request. |
| 83 | |
| 84 | \var{url} should be a string which is a valid URL. For descrtion |
| 85 | of \var{data} see the \method{add_data} description. |
| 86 | \var{headers} should be a dictionary, and will be treated as if |
| 87 | \method{add_header} was called with each key and value as arguments. |
| 88 | \end{classdesc} |
| 89 | |
| 90 | The following methods describe all of \class{Request}'s public interface, |
| 91 | and so all must be overridden in subclasses. |
| 92 | |
| 93 | \begin{methoddesc}[Request]{add_data}{data} |
| 94 | Set the \class{Request} data to \var{data} is ignored |
| 95 | by all handlers except HTTP handlers --- and there it should be an |
| 96 | \code{application/x-www-form-encoded} buffer, and will change the |
| 97 | request to be \code{POST} rather then \code{GET}. |
| 98 | \end{methoddesc} |
| 99 | |
| 100 | \begin{methoddesc}[Request]{has_data}{data} |
| 101 | Return whether the instance has a non-\code{None} data. |
| 102 | \end{methoddesc} |
| 103 | |
| 104 | \begin{methoddesc}[Request]{get_data}{data} |
| 105 | Return the instance's data. |
| 106 | \end{methoddesc} |
| 107 | |
| 108 | \begin{methoddesc}[Request]{add_header}{key, val} |
| 109 | Add another header to the request. Headers |
| 110 | are currently ignored by all handlers except HTTP handlers, where they |
| 111 | are added to the list of headers sent to the server. Note that there |
| 112 | cannot be more then one header with the same name, and later calls |
| 113 | will overwrite previous calls in case the \var{key} collides. Currently, |
| 114 | this is no loss of HTTP functionality, since all headers which have meaning |
| 115 | when used more then once have a (header-specific) way of gaining the |
| 116 | same functionality using only one header. |
| 117 | \end{methoddesc} |
| 118 | |
| 119 | \begin{methoddesc}[Request]{get_full_url}{} |
| 120 | Return the URL given in the constructor. |
| 121 | \end{methoddesc} |
| 122 | |
| 123 | \begin{methoddesc}[Request]{get_type}{} |
| 124 | Return the type of the URL --- also known as the schema. |
| 125 | \end{methoddesc} |
| 126 | |
| 127 | \begin{methoddesc}[Request]{get_host}{} |
| 128 | Return the host to which connection will be made. |
| 129 | \end{methoddesc} |
| 130 | |
| 131 | \begin{methoddesc}[Request]{get_selector}{} |
| 132 | Return the selector --- the part of the URL that is sent to |
| 133 | the server. |
| 134 | \end{methoddesc} |
| 135 | |
| 136 | \begin{methoddesc}[Request]{set_proxy}{host, type} |
| 137 | Make the request by connecting to a proxy server. The \var{host} and \var{type} |
| 138 | will replace those of the instance, and the instance's selector will be |
| 139 | the original URL given in the constructor. |
| 140 | \end{methoddesc} |
| 141 | |
| 142 | \begin{classdesc}{OpenerDirector}{} |
| 143 | The \class{OpenerDirector} class opens URLs via \class{BaseHandler}s chained |
| 144 | together. It manages the chaining of handlers, and recovery from errors. |
| 145 | \end{classdesc} |
| 146 | |
| 147 | \begin{methoddesc}[OpenerDirector]{add_handler}{handler} |
| 148 | \var{handler} should be an instance of \class{BaseHandler}. The following |
| 149 | methods are searched, and added to the possible chains. |
| 150 | |
| 151 | \begin{itemize} |
| 152 | \item \code{{\em protocol}_open} --- signal that the handler knows how |
| 153 | to open {\em protocol} URLs. |
| 154 | \item \code{{\em protocol}_error_{\em type}} -- signal that the handler |
| 155 | knows how to handle {\em type} |
| 156 | errors from {\em protocol}. |
| 157 | \end{itemize} |
| 158 | |
| 159 | \end{methoddesc} |
| 160 | |
| 161 | \begin{methoddesc}[OpenerDirector]{close}{} |
| 162 | Explicitly break cycles, and delete all the handlers. |
| 163 | Because the \class{OpenerDirector} needs to know the registered handlers, |
| 164 | and a handler needs to know who the \class{OpenerDirector} who called |
| 165 | it is, there is a reference cycles. Even though recent versions of Python |
| 166 | have cycle-collection, it is sometimes preferable to explicitly break |
| 167 | the cycles. |
| 168 | \end{methoddesc} |
| 169 | |
| 170 | \begin{methoddesc}[OpenerDirector]{open}{url\optional{, data}} |
| 171 | Open the given \var{url}. (which can be a request object or a string), |
| 172 | optionally passing the given \var{data}. |
| 173 | Arguments, return values and exceptions raised are the same as those |
| 174 | of \function{urlopen} (which simply calls the \method{open()} method |
| 175 | on the default installed \class{OpenerDirector}. |
| 176 | \end{methoddesc} |
| 177 | |
| 178 | \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, arg\optional{, ...}}} |
| 179 | Handle an error in a given protocol. The HTTP protocol is special cased to |
| 180 | use the code as the error. This will call the registered error handlers |
| 181 | for the given protocol with the given arguments (which are protocol specific). |
| 182 | |
| 183 | Return values and exceptions raised are the same as those |
| 184 | of \function{urlopen}. |
| 185 | \end{methoddesc} |
| 186 | |
| 187 | \begin{classdesc}{BaseHandler}{} |
| 188 | This is the base class for all registered handlers --- and handles only |
| 189 | the simple mechanics of registration. |
| 190 | \end{classdesc} |
| 191 | |
| 192 | \begin{methoddesc}[BaseHandler]{add_parent}{director} |
| 193 | Add a director as parent. |
| 194 | \end{methoddesc} |
| 195 | |
| 196 | \begin{methoddesc}[BaseHandler]{close}{} |
| 197 | Remove any parents. |
| 198 | \end{methoddesc} |
| 199 | |
| 200 | The following members and methods should be used only be classes derived |
| 201 | from \class{BaseHandler}: |
| 202 | |
| 203 | \begin{memberdesc}[BaseHandler]{parent} |
| 204 | A valid \class{OpenerDirector}, which can be used to open using a different |
| 205 | protocol, or handle errors. |
| 206 | \end{memberdesc} |
| 207 | |
| 208 | \begin{methoddesc}[BaseHandler]{default_open}{req} |
| 209 | This method is {\em not} defined in \class{BaseHandler}, but subclasses |
| 210 | should define it if they want to catch all URLs. |
| 211 | |
| 212 | This method, if exists, will be called by the \member{parent} |
| 213 | \class{OpenerDirector}. It should return a file-like object as described |
| 214 | in the return value of the \method{open} of \class{OpenerDirector} or |
| 215 | \code{None}. It should raise \exception{URLError}, unless a truly exceptional |
| 216 | thing happens (for example, \exception{MemoryError} should not be mapped |
| 217 | to \exception{URLError}. |
| 218 | |
| 219 | This method will be called before any protocol-specific open method. |
| 220 | \end{methoddesc} |
| 221 | |
| 222 | \begin{methoddesc}[BaseHandler]{{\em protocol}_open}{req} |
| 223 | This method is {\em not} defined in \class{BaseHandler}, but subclasses |
| 224 | should define it if they want to handle URLs with the given protocol. |
| 225 | |
| 226 | This method, if exists, will be called by the \member{parent} |
| 227 | \class{OpenerDirector}. Return values should be the same as for |
| 228 | \method{default_open}. |
| 229 | \end{methoddesc} |
| 230 | |
| 231 | \begin{methoddesc}[BaseHandler]{unknown_open}{req} |
| 232 | This method is {\em not} defined in \class{BaseHandler}, but subclasses |
| 233 | should define it if they want to catch all URLs with no specific |
| 234 | registerd handler to open it. |
| 235 | |
| 236 | This method, if exists, will be called by the \member{parent} |
| 237 | \class{OpenerDirector}. Return values should be the same as for |
| 238 | \method{default_open}. |
| 239 | \end{methoddesc} |
| 240 | |
| 241 | \begin{methoddesc}[BaseHandler]{http_error_default}{req, fp, code, msg, hdrs} |
| 242 | This method is {\em not} defined in \class{BaseHandler}, but subclasses |
| 243 | should override it if they intend to provide a catch-all for otherwise |
| 244 | unhandled HTTP errors. It will be called automatically by the |
| 245 | \class{OpenerDirector} getting the error, and should not normally be called |
| 246 | in other circumstances. |
| 247 | |
| 248 | \var{req} will be a \class{Request} object, \var{fp} will be a file-like |
| 249 | object with the HTTP error body, \var{code} will be the three-digit code |
| 250 | of the error, \var{msg} will be the user-visible explanation of the |
| 251 | code and \var{hdrs} will be a dictionary-like object with the headers of |
| 252 | the error. |
| 253 | |
| 254 | Return values and exceptions raised should be the same as those |
| 255 | of \function{urlopen}. |
| 256 | \end{methoddesc} |
| 257 | |
| 258 | \begin{methoddesc}[BaseHandler]{http_error_{\em nnn}}{req, fp, code, msg, hdrs} |
| 259 | \code{nnn} should be a three-digit HTTP error code. This method is also |
| 260 | not defined in \class{BaseHandler}, but will be called, if it exists, on |
| 261 | an instance of a subclass, when an HTTP error with code \code{nnn} occurse. |
| 262 | |
| 263 | Subclasses should override this method to handle specific HTTP errors. |
| 264 | |
| 265 | Arguments, return values and exceptions raised shoudl be the same as for |
| 266 | \method{http_error_default} |
| 267 | \end{methoddesc} |
| 268 | |
| 269 | |
| 270 | \begin{classdesc}{HTTPDefaultErrorHandler}{} |
| 271 | A class which catches all HTTP errors. |
| 272 | \end{classdesc} |
| 273 | |
| 274 | \begin{methoddesc}[HTTPDefaultErrorHandler]{http_error_default}{req, fp, code, |
| 275 | msg, hdrs} |
| 276 | Raise an \exception{HTTPError} |
| 277 | \end{methoddesc} |
| 278 | |
| 279 | \begin{classdesc}{HTTPRedirectHandler}{} |
| 280 | A class to handle redirections. |
| 281 | \end{classdesc} |
| 282 | |
| 283 | \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, fp, code, |
| 284 | msg, hdrs} |
| 285 | Redirect to the \code{Location:} URL. This method gets called by |
| 286 | the parent \class{OpenerDirector} when getting an HTTP permanent-redirect |
| 287 | error. |
| 288 | \end{methoddesc} |
| 289 | |
| 290 | \begin{methoddesc}[HTTPRedirectHandler]{http_error_302}{req, fp, code, |
| 291 | msg, hdrs} |
| 292 | The same as \method{http_error_301}. |
| 293 | \end{methoddesc} |
| 294 | |
| 295 | \strong{Note:} 303 redirection is not supported by this version of |
| 296 | \module{urllib2}. |
| 297 | |
| 298 | \begin{classdesc}{ProxyHandler}{\optional{proxies}} |
| 299 | Cause requests to go through a proxy. |
| 300 | If \var{proxies} is given, it must be a dictionary mapping |
| 301 | protocol names to URLs of proxies. |
| 302 | The default is to read the list of proxies from the environment |
| 303 | variables \code{{\em protocol}_proxy}. |
| 304 | \end{classdesc} |
| 305 | |
| 306 | \begin{methoddesc}[ProxyHandler]{{\em protocol}_open}{request} |
| 307 | The \class{ProxyHandler} will have a method \code{{\em protocol}_open} for |
| 308 | every {\em protocol} which has a proxy in the \var{proxies} dictionary |
| 309 | given in the constructor. The method will modify requests to go |
| 310 | through the proxy, by calling \code{request.set_proxy()}, and call the next |
| 311 | handler in the chain to actually execute the protocol. |
| 312 | \end{methoddesc} |
| 313 | |
| 314 | \begin{classdesc}{HTTPPasswordMgr}{} |
| 315 | Keep a database of |
| 316 | \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. |
| 317 | \end{classdesc} |
| 318 | |
| 319 | \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} |
| 320 | \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, |
| 321 | \var{user} and \var{passwd} must be strings. This causes |
| 322 | \code{(\var{user}, \var{passwd})} to be used as authentication tokens |
| 323 | when authentication for \var{realm} and a super-URI of any of the |
| 324 | given URIs is given. |
| 325 | \end{methoddesc} |
| 326 | |
| 327 | \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} |
| 328 | Get user/password for given realm and URI, if any. This method will |
| 329 | return \code{(None, None)} if there is no user/password is known. |
| 330 | \end{methoddesc} |
| 331 | |
| 332 | \begin{classdesc}{HTTPPasswordMgrWithDefaultRealm}{} |
| 333 | Keep a database of |
| 334 | \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. |
| 335 | A realm of \code{None} is considered a catch-all realm, which is searched |
| 336 | if no other realm fits. |
| 337 | \end{classdesc} |
| 338 | |
| 339 | \begin{methoddesc}[HTTPPasswordMgrWithDefaultRealm]{add_password} |
| 340 | {realm, uri, user, passwd} |
| 341 | \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, |
| 342 | \var{user} and \var{passwd} must be strings. This causes |
| 343 | \code{(\var{user}, \var{passwd})} to be used as authentication tokens |
| 344 | when authentication for \var{realm} and a super-URI of any of the |
| 345 | given URIs is given. |
| 346 | \end{methoddesc} |
| 347 | |
| 348 | \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} |
| 349 | Get user/password for given realm and URI, if any. This method will |
| 350 | return \code{(None, None)} if there is no user/password is known. |
| 351 | If the given \var{realm} has no user/password, the realm \code{None} |
| 352 | will be searched. |
| 353 | \end{methoddesc} |
| 354 | |
| 355 | \begin{classdesc}[AbstractBasicAuthHandler]{\optional{password_mgr}} |
| 356 | This is a mixin class, that helps with HTTP authentication, both |
| 357 | to the remote host and to a proxy. |
| 358 | |
| 359 | \var{password_mgr} should be something that is compatible with |
| 360 | \class{HTTPPasswordMgr} --- supplies the documented interface above. |
| 361 | \end{classdesc} |
| 362 | |
| 363 | \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} |
| 364 | {authreq, host, req, headers} |
| 365 | Handle an authentication request by getting user/password pair, and retrying. |
| 366 | \var{authreq} should be the name of the header where the information about |
| 367 | the realm, \var{host} is the host to authenticate too, \var{req} should be the |
| 368 | (failed) \class{Request} object, and \var{headers} should be the error headers. |
| 369 | \end{methoddesc} |
| 370 | |
| 371 | \begin{classdesc}{HTTPBasicAuthHandler}{\optional{password_mgr}} |
| 372 | Handle authentication with the remote host. |
| 373 | Valid \var{password_mgr}, if given, are the same as for |
| 374 | \class{AbstractBasicAuthHandler}. |
| 375 | \end{classdesc} |
| 376 | |
| 377 | \begin{methoddesc}[HTTPBasicAuthHandler]{http_error_401}{req, fp, code, |
| 378 | msg, hdrs} |
| 379 | Retry the request with authentication info, if available. |
| 380 | \end{methoddesc} |
| 381 | |
| 382 | \begin{classdesc}{ProxyBasicAuthHandler}{\optional{password_mgr}} |
| 383 | Handle authentication with the proxy. |
| 384 | Valid \var{password_mgr}, if given, are the same as for |
| 385 | \class{AbstractBasicAuthHandler}. |
| 386 | \end{classdesc} |
| 387 | |
| 388 | \begin{methoddesc}[ProxyBasicAuthHandler]{http_error_407}{req, fp, code, |
| 389 | msg, hdrs} |
| 390 | Retry the request with authentication info, if available. |
| 391 | \end{methoddesc} |
| 392 | |
| 393 | \begin{classdesc}{AbstractDigestAuthHandler}{\optional{password_mgr}} |
| 394 | This is a mixin class, that helps with HTTP authentication, both |
| 395 | to the remote host and to a proxy. |
| 396 | |
| 397 | \var{password_mgr} should be something that is compatible with |
| 398 | \class{HTTPPasswordMgr} --- supplies the documented interface above. |
| 399 | \end{classdesc} |
| 400 | |
| 401 | \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} |
| 402 | {authreq, host, req, headers} |
| 403 | \var{authreq} should be the name of the header where the information about |
| 404 | the realm, \var{host} should be the host to authenticate too, \var{req} |
| 405 | should be the (failed) \class{Request} object, and \var{headers} should be the |
| 406 | error headers. |
| 407 | \end{methoddesc} |
| 408 | |
| 409 | \begin{classdesc}{HTTPDigestAuthHandler}{\optional{password_mgr}} |
| 410 | Handle authentication with the remote host. |
| 411 | Valid \var{password_mgr}, if given, are the same as for |
| 412 | \class{AbstractBasicAuthHandler}. |
| 413 | \end{classdesc} |
| 414 | |
| 415 | \begin{methoddesc}[HTTPDigestAuthHandler]{http_error_401}{req, fp, code, |
| 416 | msg, hdrs} |
| 417 | Retry the request with authentication info, if available. |
| 418 | \end{methoddesc} |
| 419 | |
| 420 | \begin{classdesc}{ProxyDigestAuthHandler}{\optional{password_mgr}} |
| 421 | Handle authentication with the proxy. |
| 422 | \var{password_mgr}, if given, shoudl be the same as for |
| 423 | the constructor of \class{AbstractDigestAuthHandler}. |
| 424 | \end{classdesc} |
| 425 | |
| 426 | \begin{methoddesc}[ProxyDigestAuthHandler]{http_error_407}{req, fp, code, |
| 427 | msg, hdrs} |
| 428 | Retry the request with authentication info, if available. |
| 429 | \end{methoddesc} |
| 430 | |
| 431 | \begin{classdesc}{HTTPHandler}{} |
| 432 | A class to handle opening of HTTP URLs |
| 433 | \end{classdesc} |
| 434 | |
| 435 | \begin{methoddesc}[HTTPHandler]{http_open}{req} |
| 436 | Send an HTTP request (either GET or POST, depending on whether |
| 437 | \code{req.has_data()}. |
| 438 | \end{methoddesc} |
| 439 | |
| 440 | \begin{classdesc}{HTTPSHandler}{} |
| 441 | A class to handle opening of HTTPS URLs |
| 442 | \end{classdesc} |
| 443 | |
| 444 | \begin{methoddesc}[HTTPSHandler]{https_open}{req} |
| 445 | Send an HTTPS request (either GET or POST, depending on whether |
| 446 | \code{req.has_data()}. |
| 447 | \end{methoddesc} |
| 448 | |
| 449 | \begin{classdesc}{UknownHandler}{} |
| 450 | A catch-all class to handle unknown URLs. |
| 451 | \end{classdesc} |
| 452 | |
| 453 | \begin{methoddesc}[UknownHandler]{unknown_open} |
| 454 | Raise a \exception{URLError} exception |
| 455 | \end{methoddesc} |
| 456 | |
| 457 | \begin{classdesc}{FileHandler}{} |
| 458 | Open local files. |
| 459 | \end{classdesc} |
| 460 | |
| 461 | \begin{methoddesc}[FileHandler]{file_open}{req} |
| 462 | Open the file locally, if there is no host name, or |
| 463 | the host name is \code{"localhost"}. Change the |
| 464 | protocol to \code{ftp} otherwise, and retry opening |
| 465 | it using \member{parent}. |
| 466 | \end{methoddesc} |
| 467 | |
| 468 | \begin{classdesc}{FTPHandler}{} |
| 469 | Open FTP URLs. |
| 470 | \end{classdesc} |
| 471 | |
| 472 | \begin{methoddesc}[FTPHandler]{ftp_open}{req} |
| 473 | Open the FTP file indicated by \var{req}. |
| 474 | The login is always done with empty username and password. |
| 475 | \end{methoddesc} |
| 476 | |
| 477 | \begin{classdesc}{CacheFTPHandler}{} |
| 478 | Open FTP URLs, keeping a cache of open FTP connections to minimize |
| 479 | delays. |
| 480 | \end{classdesc} |
| 481 | |
| 482 | \begin{methoddesc}[CacheFTPHandler]{ftp_open}{req} |
| 483 | Open the FTP file indicated by \var{req}. |
| 484 | The login is always done with empty username and password. |
| 485 | \end{methoddesc} |
| 486 | |
| 487 | \begin{methoddesc}[CacheFTPHandler]{setTimeout}{t} |
| 488 | Set timeout of connections to \var{t} seconds. |
| 489 | \end{methoddesc} |
| 490 | |
| 491 | \begin{methoddesc}[CacheFTPHandler]{setMaxConns}{m} |
| 492 | Set maximum number of cached connections to \var{m}. |
| 493 | \end{methoddesc} |
| 494 | |
| 495 | \begin{classdesc}{GopherHandler}{} |
| 496 | Open gopher URLs. |
| 497 | \end{classdesc} |
| 498 | |
| 499 | \begin{methoddesc}[GopherHandler]{gopher_open}{req} |
| 500 | Open the gopher resource indicated by \var{req}. |
| 501 | \end{methoddesc} |