iweb.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. # -*- test-case-name: twisted.web.test -*-
  2. # Copyright (c) Twisted Matrix Laboratories.
  3. # See LICENSE for details.
  4. """
  5. Interface definitions for L{twisted.web}.
  6. @var UNKNOWN_LENGTH: An opaque object which may be used as the value of
  7. L{IBodyProducer.length} to indicate that the length of the entity
  8. body is not known in advance.
  9. """
  10. from zope.interface import Interface, Attribute
  11. from twisted.internet.interfaces import IPushProducer
  12. from twisted.cred.credentials import IUsernameDigestHash
  13. class IRequest(Interface):
  14. """
  15. An HTTP request.
  16. @since: 9.0
  17. """
  18. method = Attribute("A C{str} giving the HTTP method that was used.")
  19. uri = Attribute(
  20. "A C{str} giving the full encoded URI which was requested (including "
  21. "query arguments).")
  22. path = Attribute(
  23. "A C{str} giving the encoded query path of the request URI.")
  24. args = Attribute(
  25. "A mapping of decoded query argument names as C{str} to "
  26. "corresponding query argument values as C{list}s of C{str}. "
  27. "For example, for a URI with C{'foo=bar&foo=baz&quux=spam'} "
  28. "for its query part, C{args} will be C{{'foo': ['bar', 'baz'], "
  29. "'quux': ['spam']}}.")
  30. requestHeaders = Attribute(
  31. "A L{http_headers.Headers} instance giving all received HTTP request "
  32. "headers.")
  33. content = Attribute(
  34. "A file-like object giving the request body. This may be a file on "
  35. "disk, a C{StringIO}, or some other type. The implementation is free "
  36. "to decide on a per-request basis.")
  37. responseHeaders = Attribute(
  38. "A L{http_headers.Headers} instance holding all HTTP response "
  39. "headers to be sent.")
  40. def getHeader(key):
  41. """
  42. Get an HTTP request header.
  43. @type key: C{str}
  44. @param key: The name of the header to get the value of.
  45. @rtype: C{str} or L{None}
  46. @return: The value of the specified header, or L{None} if that header
  47. was not present in the request.
  48. """
  49. def getCookie(key):
  50. """
  51. Get a cookie that was sent from the network.
  52. """
  53. def getAllHeaders():
  54. """
  55. Return dictionary mapping the names of all received headers to the last
  56. value received for each.
  57. Since this method does not return all header information,
  58. C{requestHeaders.getAllRawHeaders()} may be preferred.
  59. """
  60. def getRequestHostname():
  61. """
  62. Get the hostname that the user passed in to the request.
  63. This will either use the Host: header (if it is available) or the
  64. host we are listening on if the header is unavailable.
  65. @returns: the requested hostname
  66. @rtype: C{str}
  67. """
  68. def getHost():
  69. """
  70. Get my originally requesting transport's host.
  71. @return: An L{IAddress<twisted.internet.interfaces.IAddress>}.
  72. """
  73. def getClientIP():
  74. """
  75. Return the IP address of the client who submitted this request.
  76. @returns: the client IP address or L{None} if the request was submitted
  77. over a transport where IP addresses do not make sense.
  78. @rtype: L{str} or L{None}
  79. """
  80. def getClient():
  81. """
  82. Return the hostname of the IP address of the client who submitted this
  83. request, if possible.
  84. This method is B{deprecated}. See L{getClientIP} instead.
  85. @rtype: L{None} or L{str}
  86. @return: The canonical hostname of the client, as determined by
  87. performing a name lookup on the IP address of the client.
  88. """
  89. def getUser():
  90. """
  91. Return the HTTP user sent with this request, if any.
  92. If no user was supplied, return the empty string.
  93. @returns: the HTTP user, if any
  94. @rtype: C{str}
  95. """
  96. def getPassword():
  97. """
  98. Return the HTTP password sent with this request, if any.
  99. If no password was supplied, return the empty string.
  100. @returns: the HTTP password, if any
  101. @rtype: C{str}
  102. """
  103. def isSecure():
  104. """
  105. Return True if this request is using a secure transport.
  106. Normally this method returns True if this request's HTTPChannel
  107. instance is using a transport that implements ISSLTransport.
  108. This will also return True if setHost() has been called
  109. with ssl=True.
  110. @returns: True if this request is secure
  111. @rtype: C{bool}
  112. """
  113. def getSession(sessionInterface=None):
  114. """
  115. Look up the session associated with this request or create a new one if
  116. there is not one.
  117. @return: The L{Session} instance identified by the session cookie in
  118. the request, or the C{sessionInterface} component of that session
  119. if C{sessionInterface} is specified.
  120. """
  121. def URLPath():
  122. """
  123. @return: A L{URLPath} instance which identifies the URL for which this
  124. request is.
  125. """
  126. def prePathURL():
  127. """
  128. @return: At any time during resource traversal, a L{str} giving an
  129. absolute URL to the most nested resource which has yet been
  130. reached.
  131. """
  132. def rememberRootURL():
  133. """
  134. Remember the currently-processed part of the URL for later
  135. recalling.
  136. """
  137. def getRootURL():
  138. """
  139. Get a previously-remembered URL.
  140. """
  141. # Methods for outgoing response
  142. def finish():
  143. """
  144. Indicate that the response to this request is complete.
  145. """
  146. def write(data):
  147. """
  148. Write some data to the body of the response to this request. Response
  149. headers are written the first time this method is called, after which
  150. new response headers may not be added.
  151. """
  152. def addCookie(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):
  153. """
  154. Set an outgoing HTTP cookie.
  155. In general, you should consider using sessions instead of cookies, see
  156. L{twisted.web.server.Request.getSession} and the
  157. L{twisted.web.server.Session} class for details.
  158. """
  159. def setResponseCode(code, message=None):
  160. """
  161. Set the HTTP response code.
  162. """
  163. def setHeader(k, v):
  164. """
  165. Set an HTTP response header. Overrides any previously set values for
  166. this header.
  167. @type name: C{str}
  168. @param name: The name of the header for which to set the value.
  169. @type value: C{str}
  170. @param value: The value to set for the named header.
  171. """
  172. def redirect(url):
  173. """
  174. Utility function that does a redirect.
  175. The request should have finish() called after this.
  176. """
  177. def setLastModified(when):
  178. """
  179. Set the C{Last-Modified} time for the response to this request.
  180. If I am called more than once, I ignore attempts to set Last-Modified
  181. earlier, only replacing the Last-Modified time if it is to a later
  182. value.
  183. If I am a conditional request, I may modify my response code to
  184. L{NOT_MODIFIED<http.NOT_MODIFIED>} if appropriate for the time given.
  185. @param when: The last time the resource being returned was modified, in
  186. seconds since the epoch.
  187. @type when: L{int}, L{long} or L{float}
  188. @return: If I am a C{If-Modified-Since} conditional request and the time
  189. given is not newer than the condition, I return
  190. L{CACHED<http.CACHED>} to indicate that you should write no body.
  191. Otherwise, I return a false value.
  192. """
  193. def setETag(etag):
  194. """
  195. Set an C{entity tag} for the outgoing response.
  196. That's "entity tag" as in the HTTP/1.1 I{ETag} header, "used for
  197. comparing two or more entities from the same requested resource."
  198. If I am a conditional request, I may modify my response code to
  199. L{NOT_MODIFIED<http.NOT_MODIFIED>} or
  200. L{PRECONDITION_FAILED<http.PRECONDITION_FAILED>}, if appropriate for the
  201. tag given.
  202. @param etag: The entity tag for the resource being returned.
  203. @type etag: C{str}
  204. @return: If I am a C{If-None-Match} conditional request and the tag
  205. matches one in the request, I return L{CACHED<http.CACHED>} to
  206. indicate that you should write no body. Otherwise, I return a
  207. false value.
  208. """
  209. def setHost(host, port, ssl=0):
  210. """
  211. Change the host and port the request thinks it's using.
  212. This method is useful for working with reverse HTTP proxies (e.g. both
  213. Squid and Apache's mod_proxy can do this), when the address the HTTP
  214. client is using is different than the one we're listening on.
  215. For example, Apache may be listening on https://www.example.com, and
  216. then forwarding requests to http://localhost:8080, but we don't want
  217. HTML produced by Twisted to say 'http://localhost:8080', they should
  218. say 'https://www.example.com', so we do::
  219. request.setHost('www.example.com', 443, ssl=1)
  220. """
  221. class INonQueuedRequestFactory(Interface):
  222. """
  223. A factory of L{IRequest} objects that does not take a ``queued`` parameter.
  224. """
  225. def __call__(channel):
  226. """
  227. Create an L{IRequest} that is operating on the given channel. There
  228. must only be one L{IRequest} object processing at any given time on a
  229. channel.
  230. @param channel: A L{twisted.web.http.HTTPChannel} object.
  231. @type channel: L{twisted.web.http.HTTPChannel}
  232. @return: A request object.
  233. @rtype: L{IRequest}
  234. """
  235. class IAccessLogFormatter(Interface):
  236. """
  237. An object which can represent an HTTP request as a line of text for
  238. inclusion in an access log file.
  239. """
  240. def __call__(timestamp, request):
  241. """
  242. Generate a line for the access log.
  243. @param timestamp: The time at which the request was completed in the
  244. standard format for access logs.
  245. @type timestamp: L{unicode}
  246. @param request: The request object about which to log.
  247. @type request: L{twisted.web.server.Request}
  248. @return: One line describing the request without a trailing newline.
  249. @rtype: L{unicode}
  250. """
  251. class ICredentialFactory(Interface):
  252. """
  253. A credential factory defines a way to generate a particular kind of
  254. authentication challenge and a way to interpret the responses to these
  255. challenges. It creates
  256. L{ICredentials<twisted.cred.credentials.ICredentials>} providers from
  257. responses. These objects will be used with L{twisted.cred} to authenticate
  258. an authorize requests.
  259. """
  260. scheme = Attribute(
  261. "A C{str} giving the name of the authentication scheme with which "
  262. "this factory is associated. For example, C{'basic'} or C{'digest'}.")
  263. def getChallenge(request):
  264. """
  265. Generate a new challenge to be sent to a client.
  266. @type peer: L{twisted.web.http.Request}
  267. @param peer: The request the response to which this challenge will be
  268. included.
  269. @rtype: C{dict}
  270. @return: A mapping from C{str} challenge fields to associated C{str}
  271. values.
  272. """
  273. def decode(response, request):
  274. """
  275. Create a credentials object from the given response.
  276. @type response: C{str}
  277. @param response: scheme specific response string
  278. @type request: L{twisted.web.http.Request}
  279. @param request: The request being processed (from which the response
  280. was taken).
  281. @raise twisted.cred.error.LoginFailed: If the response is invalid.
  282. @rtype: L{twisted.cred.credentials.ICredentials} provider
  283. @return: The credentials represented by the given response.
  284. """
  285. class IBodyProducer(IPushProducer):
  286. """
  287. Objects which provide L{IBodyProducer} write bytes to an object which
  288. provides L{IConsumer<twisted.internet.interfaces.IConsumer>} by calling its
  289. C{write} method repeatedly.
  290. L{IBodyProducer} providers may start producing as soon as they have an
  291. L{IConsumer<twisted.internet.interfaces.IConsumer>} provider. That is, they
  292. should not wait for a C{resumeProducing} call to begin writing data.
  293. L{IConsumer.unregisterProducer<twisted.internet.interfaces.IConsumer.unregisterProducer>}
  294. must not be called. Instead, the
  295. L{Deferred<twisted.internet.defer.Deferred>} returned from C{startProducing}
  296. must be fired when all bytes have been written.
  297. L{IConsumer.write<twisted.internet.interfaces.IConsumer.write>} may
  298. synchronously invoke any of C{pauseProducing}, C{resumeProducing}, or
  299. C{stopProducing}. These methods must be implemented with this in mind.
  300. @since: 9.0
  301. """
  302. # Despite the restrictions above and the additional requirements of
  303. # stopProducing documented below, this interface still needs to be an
  304. # IPushProducer subclass. Providers of it will be passed to IConsumer
  305. # providers which only know about IPushProducer and IPullProducer, not
  306. # about this interface. This interface needs to remain close enough to one
  307. # of those interfaces for consumers to work with it.
  308. length = Attribute(
  309. """
  310. C{length} is a C{int} indicating how many bytes in total this
  311. L{IBodyProducer} will write to the consumer or L{UNKNOWN_LENGTH}
  312. if this is not known in advance.
  313. """)
  314. def startProducing(consumer):
  315. """
  316. Start producing to the given
  317. L{IConsumer<twisted.internet.interfaces.IConsumer>} provider.
  318. @return: A L{Deferred<twisted.internet.defer.Deferred>} which fires with
  319. L{None} when all bytes have been produced or with a
  320. L{Failure<twisted.python.failure.Failure>} if there is any problem
  321. before all bytes have been produced.
  322. """
  323. def stopProducing():
  324. """
  325. In addition to the standard behavior of
  326. L{IProducer.stopProducing<twisted.internet.interfaces.IProducer.stopProducing>}
  327. (stop producing data), make sure the
  328. L{Deferred<twisted.internet.defer.Deferred>} returned by
  329. C{startProducing} is never fired.
  330. """
  331. class IRenderable(Interface):
  332. """
  333. An L{IRenderable} is an object that may be rendered by the
  334. L{twisted.web.template} templating system.
  335. """
  336. def lookupRenderMethod(name):
  337. """
  338. Look up and return the render method associated with the given name.
  339. @type name: C{str}
  340. @param name: The value of a render directive encountered in the
  341. document returned by a call to L{IRenderable.render}.
  342. @return: A two-argument callable which will be invoked with the request
  343. being responded to and the tag object on which the render directive
  344. was encountered.
  345. """
  346. def render(request):
  347. """
  348. Get the document for this L{IRenderable}.
  349. @type request: L{IRequest} provider or L{None}
  350. @param request: The request in response to which this method is being
  351. invoked.
  352. @return: An object which can be flattened.
  353. """
  354. class ITemplateLoader(Interface):
  355. """
  356. A loader for templates; something usable as a value for
  357. L{twisted.web.template.Element}'s C{loader} attribute.
  358. """
  359. def load():
  360. """
  361. Load a template suitable for rendering.
  362. @return: a C{list} of C{list}s, C{unicode} objects, C{Element}s and
  363. other L{IRenderable} providers.
  364. """
  365. class IResponse(Interface):
  366. """
  367. An object representing an HTTP response received from an HTTP server.
  368. @since: 11.1
  369. """
  370. version = Attribute(
  371. "A three-tuple describing the protocol and protocol version "
  372. "of the response. The first element is of type C{str}, the second "
  373. "and third are of type C{int}. For example, C{('HTTP', 1, 1)}.")
  374. code = Attribute("The HTTP status code of this response, as a C{int}.")
  375. phrase = Attribute(
  376. "The HTTP reason phrase of this response, as a C{str}.")
  377. headers = Attribute("The HTTP response L{Headers} of this response.")
  378. length = Attribute(
  379. "The C{int} number of bytes expected to be in the body of this "
  380. "response or L{UNKNOWN_LENGTH} if the server did not indicate how "
  381. "many bytes to expect. For I{HEAD} responses, this will be 0; if "
  382. "the response includes a I{Content-Length} header, it will be "
  383. "available in C{headers}.")
  384. request = Attribute(
  385. "The L{IClientRequest} that resulted in this response.")
  386. previousResponse = Attribute(
  387. "The previous L{IResponse} from a redirect, or L{None} if there was no "
  388. "previous response. This can be used to walk the response or request "
  389. "history for redirections.")
  390. def deliverBody(protocol):
  391. """
  392. Register an L{IProtocol<twisted.internet.interfaces.IProtocol>} provider
  393. to receive the response body.
  394. The protocol will be connected to a transport which provides
  395. L{IPushProducer}. The protocol's C{connectionLost} method will be
  396. called with:
  397. - ResponseDone, which indicates that all bytes from the response
  398. have been successfully delivered.
  399. - PotentialDataLoss, which indicates that it cannot be determined
  400. if the entire response body has been delivered. This only occurs
  401. when making requests to HTTP servers which do not set
  402. I{Content-Length} or a I{Transfer-Encoding} in the response.
  403. - ResponseFailed, which indicates that some bytes from the response
  404. were lost. The C{reasons} attribute of the exception may provide
  405. more specific indications as to why.
  406. """
  407. def setPreviousResponse(response):
  408. """
  409. Set the reference to the previous L{IResponse}.
  410. The value of the previous response can be read via
  411. L{IResponse.previousResponse}.
  412. """
  413. class _IRequestEncoder(Interface):
  414. """
  415. An object encoding data passed to L{IRequest.write}, for example for
  416. compression purpose.
  417. @since: 12.3
  418. """
  419. def encode(data):
  420. """
  421. Encode the data given and return the result.
  422. @param data: The content to encode.
  423. @type data: C{str}
  424. @return: The encoded data.
  425. @rtype: C{str}
  426. """
  427. def finish():
  428. """
  429. Callback called when the request is closing.
  430. @return: If necessary, the pending data accumulated from previous
  431. C{encode} calls.
  432. @rtype: C{str}
  433. """
  434. class _IRequestEncoderFactory(Interface):
  435. """
  436. A factory for returing L{_IRequestEncoder} instances.
  437. @since: 12.3
  438. """
  439. def encoderForRequest(request):
  440. """
  441. If applicable, returns a L{_IRequestEncoder} instance which will encode
  442. the request.
  443. """
  444. class IClientRequest(Interface):
  445. """
  446. An object representing an HTTP request to make to an HTTP server.
  447. @since: 13.1
  448. """
  449. method = Attribute(
  450. "The HTTP method for this request, as L{bytes}. For example: "
  451. "C{b'GET'}, C{b'HEAD'}, C{b'POST'}, etc.")
  452. absoluteURI = Attribute(
  453. "The absolute URI of the requested resource, as L{bytes}; or L{None} "
  454. "if the absolute URI cannot be determined.")
  455. headers = Attribute(
  456. "Headers to be sent to the server, as "
  457. "a L{twisted.web.http_headers.Headers} instance.")
  458. class IAgent(Interface):
  459. """
  460. An agent makes HTTP requests.
  461. The way in which requests are issued is left up to each implementation.
  462. Some may issue them directly to the server indicated by the net location
  463. portion of the request URL. Others may use a proxy specified by system
  464. configuration.
  465. Processing of responses is also left very widely specified. An
  466. implementation may perform no special handling of responses, or it may
  467. implement redirect following or content negotiation, it may implement a
  468. cookie store or automatically respond to authentication challenges. It may
  469. implement many other unforeseen behaviors as well.
  470. It is also intended that L{IAgent} implementations be composable. An
  471. implementation which provides cookie handling features should re-use an
  472. implementation that provides connection pooling and this combination could
  473. be used by an implementation which adds content negotiation functionality.
  474. Some implementations will be completely self-contained, such as those which
  475. actually perform the network operations to send and receive requests, but
  476. most or all other implementations should implement a small number of new
  477. features (perhaps one new feature) and delegate the rest of the
  478. request/response machinery to another implementation.
  479. This allows for great flexibility in the behavior an L{IAgent} will
  480. provide. For example, an L{IAgent} with web browser-like behavior could be
  481. obtained by combining a number of (hypothetical) implementations::
  482. baseAgent = Agent(reactor)
  483. redirect = BrowserLikeRedirectAgent(baseAgent, limit=10)
  484. authenticate = AuthenticateAgent(
  485. redirect, [diskStore.credentials, GtkAuthInterface()])
  486. cookie = CookieAgent(authenticate, diskStore.cookie)
  487. decode = ContentDecoderAgent(cookie, [(b"gzip", GzipDecoder())])
  488. cache = CacheAgent(decode, diskStore.cache)
  489. doSomeRequests(cache)
  490. """
  491. def request(method, uri, headers=None, bodyProducer=None):
  492. """
  493. Request the resource at the given location.
  494. @param method: The request method to use, such as C{"GET"}, C{"HEAD"},
  495. C{"PUT"}, C{"POST"}, etc.
  496. @type method: L{bytes}
  497. @param uri: The location of the resource to request. This should be an
  498. absolute URI but some implementations may support relative URIs
  499. (with absolute or relative paths). I{HTTP} and I{HTTPS} are the
  500. schemes most likely to be supported but others may be as well.
  501. @type uri: L{bytes}
  502. @param headers: The headers to send with the request (or L{None} to
  503. send no extra headers). An implementation may add its own headers
  504. to this (for example for client identification or content
  505. negotiation).
  506. @type headers: L{Headers} or L{None}
  507. @param bodyProducer: An object which can generate bytes to make up the
  508. body of this request (for example, the properly encoded contents of
  509. a file for a file upload). Or, L{None} if the request is to have
  510. no body.
  511. @type bodyProducer: L{IBodyProducer} provider
  512. @return: A L{Deferred} that fires with an L{IResponse} provider when
  513. the header of the response has been received (regardless of the
  514. response status code) or with a L{Failure} if there is any problem
  515. which prevents that response from being received (including
  516. problems that prevent the request from being sent).
  517. @rtype: L{Deferred}
  518. """
  519. class IPolicyForHTTPS(Interface):
  520. """
  521. An L{IPolicyForHTTPS} provides a policy for verifying the certificates of
  522. HTTPS connections, in the form of a L{client connection creator
  523. <twisted.internet.interfaces.IOpenSSLClientConnectionCreator>} per network
  524. location.
  525. @since: 14.0
  526. """
  527. def creatorForNetloc(hostname, port):
  528. """
  529. Create a L{client connection creator
  530. <twisted.internet.interfaces.IOpenSSLClientConnectionCreator>}
  531. appropriate for the given URL "netloc"; i.e. hostname and port number
  532. pair.
  533. @param hostname: The name of the requested remote host.
  534. @type hostname: L{bytes}
  535. @param port: The number of the requested remote port.
  536. @type port: L{int}
  537. @return: A client connection creator expressing the security
  538. requirements for the given remote host.
  539. @rtype: L{client connection creator
  540. <twisted.internet.interfaces.IOpenSSLClientConnectionCreator>}
  541. """
  542. class IAgentEndpointFactory(Interface):
  543. """
  544. An L{IAgentEndpointFactory} provides a way of constructing an endpoint
  545. used for outgoing Agent requests. This is useful in the case of needing to
  546. proxy outgoing connections, or to otherwise vary the transport used.
  547. @since: 15.0
  548. """
  549. def endpointForURI(uri):
  550. """
  551. Construct and return an L{IStreamClientEndpoint} for the outgoing
  552. request's connection.
  553. @param uri: The URI of the request.
  554. @type uri: L{twisted.web.client.URI}
  555. @return: An endpoint which will have its C{connect} method called to
  556. issue the request.
  557. @rtype: an L{IStreamClientEndpoint} provider
  558. @raises twisted.internet.error.SchemeNotSupported: If the given
  559. URI's scheme cannot be handled by this factory.
  560. """
  561. UNKNOWN_LENGTH = u"twisted.web.iweb.UNKNOWN_LENGTH"
  562. __all__ = [
  563. "IUsernameDigestHash", "ICredentialFactory", "IRequest",
  564. "IBodyProducer", "IRenderable", "IResponse", "_IRequestEncoder",
  565. "_IRequestEncoderFactory", "IClientRequest",
  566. "UNKNOWN_LENGTH"]