轻巧,异步HTTP客户端:Carrier

jopen 10年前

Carrier 是一个轻量级,异步HTTP客户端。构建在 cl-asyncfast-http 之上。

其目的是通过HTTP实现简单和高效的流数据。它与drakma-async类似。

request (function)

(defun request (url &key (method :get) headers body store-body header-callback body-callback finish-callback))    => promise

Perform an HTTP request. Returns a promise (to be used withcl-async-future) that is finished when the response has fully downloaded.

  • url - the URL we're requesting.
  • method - a keyword method (:get, :post, etc). Defaults to :get.
  • headers - a hash table or plist of headers to set with the request. Note that the "Host" header is set automatically (if not proveded) and if the body argument is passed, then "Content-Length" is set as well.
  • body - A string or byte array to send as the HTTP body. If present, will set the "Content-Length" header automatically in the request.
  • store-body - If T, will store the entire HTTP response body and finish the returned promise with it once complete. If this is left nil, then the first value of the finished promise will be nil.
  • header-callback - A function that is called once the headers from theresponse are fully parsed. The only argument is a hash table of headers.

项目主页:http://www.open-open.com/lib/view/home/1416207237352