Changeset 32038 in project


Ignore:
Timestamp:
12/18/14 20:04:53 (6 years ago)
Author:
sjamaan
Message:

Add call-with-input-request* to documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/http-client

    r30426 r32038  
    2626<procedure>(call-with-response request writer reader)</procedure>
    2727
    28 This is the core http-client procedure.  It is only necessary to use
    29 this when you want the most control over the request/response cycle.
     28This is the core http-client procedure, but it is also pretty
     29low-level.  It is only necessary to use this when you want the most
     30control over the request/response cycle.  Otherwise, you should use
     31{{with-input-from-request}}, {{call-with-input-request}} or
     32{{call-with-input-request*}}.
     33
    3034{{request}} is the request object that contains information about the
    3135request to perform.  {{reader}} is a procedure that receives the
     
    113117; {{headers:}} : Additional headers to send for this entry (an [[intarweb]] headers-object).
    114118
     119<procedure>(call-with-input-request* uri-or-request writer reader)</procedure>
     120
     121As {{call-with-input-request}}, except {{reader}} is passed two
     122arguments: the input port and the complete intarweb response object
     123(useful for when you want to inspect headers or other aspects of the
     124response).
     125
     126Please note that the port is '''not''' the same as the
     127{{response-port}} from the response object: the port is delimited so
     128that you can read until {{EOF}}.  The {{response-port}} is the
     129original underlying, unbounded port.  If you do want to read from it,
     130you must make sure to read no more than what's in the
     131{{Content-Length}} header, if present.  If the header is not present,
     132it will either be a chunked port (which is implicitly delimited by
     133intarweb) or the port will be closed by the remote end after it is
     134consumed, so you can read until EOF in that case.
     135
    115136<procedure>(with-input-from-request uri-or-request writer-thunk reader-thunk)</procedure>
    116137
     
    378399=== Changelog
    379400
     401* 0.7.2 Add {{call-with-input-request*}}. Thanks to [[/users/mario-domenech-goulart|Mario Goulart]] for suggesting this.
    380402* 0.7.1 Fix delimited port handling of {{peek-char}} which caused mysterious openssl errors.  Thanks to [[/users/mario-domenech-goulart|Mario Goulart]] for a reproducible test case.
    381403* 0.7 Reduce CPU usage by implementing custom {{read-string!}} and {{read-line}} procedures in {{make-delimited-input-port}}. Improved error reporting (show URI as string, and always include it in error messages). Gracefully handle premature disconnection by retrying (as per RFC2616, 8.2.4).  Make openssl an optional dependency to make it easier to install on Windows.
Note: See TracChangeset for help on using the changeset viewer.