anchor.diff:    (clear-callbacks http-base))
   
   (defun get-method (enum)
  +  "Given a libevent EVHTTP_REQ enum key word, return the appropriate method
  +   string."
     (case enum
       (:+evhttp-req-get+ "GET")
       (:+evhttp-req-post+ "POST")
       (:+evhttp-req-head+ "HEAD")
       (:+evhttp-req-put+ "PUT")
       (:+evhttp-req-delete+ "DELETE")
  -    (:+evhttp-req-options "OPTIONS")
  +    (:+evhttp-req-options+ "OPTIONS")
       (:+evhttp-req-trace+ "TRACE")
       (:+evhttp-req-connect+ "CONNECT")
       (:+evhttp-req-patch+ "PATCH")))
  +
  +(defun get-method-reverse (method)
  +  "Given a method string, return the appropriate enum value for the libevent
  +   type."
  +  (case (cond
  +          ((stringp method) (read-from-string method))
  +          ((symbolp method) method))
  +    (GET :+evhttp-req-get+)
  +    (POST :+evhttp-req-post+)
  +    (HEAD :+evhttp-req-head+)
  +    (PUT :+evhttp-req-put+)
  +    (DELETE :+evhttp-req-delete+)
  +    (OPTIONS :+evhttp-req-options+)
  +    (TRACE :+evhttp-req-trace+)
  +    (CONNECT :+evhttp-req-connect+)
  +    (PATCH :+evhttp-req-patch+)
  +    (t :+evhttp-req-get+)))
  +
  +(defun http-get-headers (http-headers)
  +  "Pull the headers out of an HTTP request as a plist."
  +  (let ((header-ptr (le-a:evkeyvalq-thq-first http-headers))
  +        (headers nil))
  +    (loop while (not (cffi:null-pointer-p header-ptr)) do
  +      (let ((key (le-a:evkeyval-key header-ptr))
  +            (val (le-a:evkeyval-value header-ptr)))
  +        (push (cons key val) headers)
  +        (setf header-ptr (le-a:evkeyval-next header-ptr))))
  +    headers))
   
   (cffi:defcallback http-request-cb :void ((request :pointer) (http-base :pointer))
     "ALL HTTP requests come through here. They are processed into the http-request
  
positive.code:               :password pass
                :host host
                :port (if port (read-from-string port) 80)
                :resource resource)))))
  
  (defun http-client (uri &key (method "GET") headers body)
    (check-event-loop-running)
    (let ((dns-base (le:evdns-base-new *event-base* 1)))
    (let ((request (le:evhttp-connection-base-new *event-base* 
  
  (defun http-server (bind port request-cb fail-cb)
    "Start an HTTP server. If `bind` is nil, it bind to 0.0.0.0."
  
negative.code:            (find-q (position #\? uri))
             (resource (if find-q (subseq uri 0 find-q)))
             (querystring (if find-q (subseq uri (1+ find-q)) ""))
             (body (drain-evbuffer (le:evhttp-request-get-input-buffer request)))
             (headers (http-get-headers (le:evhttp-request-get-input-headers request))))
        ;; grab the headers and build the final request object, then pass it into
        ;; the callback
        (let ((http-request (make-instance 'http-request
                                           :c request
                                           :method method
                                           :uri uri
                                           :resource resource
                                           :querystring querystring
                                           :headers headers
                                           :body body)))
          (funcall request-cb http-request)))))
  
  (cffi:defcallback http-client-cb :void ((request :pointer) (arg :pointer))
    (let* ((callbacks (get-callbacks arg))
           (request-cb (getf callbacks :request-cb))
           (fail-cb (getf callbacks :fail-cb)))
      (cond
        ((cffi:null-pointer-p request)
         (funcall fail-cb :timeout))
        ((eq (le:evhttp-request-get-response-code request) 0)
         (funcall fail-cb :connection-refused))
        (t
         (let ((status (le:evhttp-request-get-response-code request))
               (body (drain-evbuffer (le:evhttp-request-get-input-buffer request)))
               (headers (http-get-headers (le:evhttp-request-get-input-headers request))))
           ;(le:evhttp-request-free request)
           (funcall request-cb status headers body))))
      (error "sexrobot")))
  
  (defun lookup-status-text (status-code)
    "Get the HTTP standard text that goes along with a status code."
  