fast-http - HTTP 协议解析库


MIT
跨平台
Lisp

软件简介

fast-http 是 Common Lisp 语言实现的快速 HTTP 请求和响应的协议解析库,大部分移植自 C 语言版本的 http-
parser
.

fast-http 的性能比较:

NOTE: Deleted PicoHTTPParser because
the benchmark was wrong. It’s 3.7 times faster than fast-http. Amazing.

详情请看 Benchmark

使用方法:

(let* ((http (make-http-request))
       (parser (make-parser http
                            :header-callback (lambda (headers)
                                               (my-app:got-headers!!! headers))
                            :body-callback (lambda (bytes)
                                             (my-app:got-body-piece bytes)))))
  (loop for http-data = (my-app:get-http-data-from-request-i-sent-out-earlier) do
    (multiple-value-bind (http headers-finished-p body-finished-p)
        (funcall parser http-data)
      (when body-finished-p
        (my-app:close-http-stream))
      ...)))