~nytpu/lasso

cebcde50cbab557deaf2ccf9b7bda6ad3c16571e — nytpu a month ago 7a833d5 master
fix bugs regarding using external client
2 files changed, 7 insertions(+), 6 deletions(-)

M gemini.lisp
M routes.lisp
M gemini.lisp => gemini.lisp +6 -5
@@ 27,14 27,15 @@
          (typecheck (cadr %) (or string null)))
   (:documentation "Initiate a TLS connection to the host and port indicated by either URI or HOST & PORT, with a request header of URI, and return an TYPES:ARTICLE-INFO."))
  (log:info "making gemini request to " uri)
  (multiple-value-bind (body status meta)
  (multiple-value-bind (body status parsed-meta meta)
      (smallnet.gemini:gemini-request uri :host host :port port)
    (when (and (eq :success status)
               (not (string= "text" (mimeparse::media-type meta))))
      (error "Non-textual response type: ~s" uri))
               (not (string= "text" (mimeparse::media-type parsed-meta))))
      (error "Non-textual response type ~s from ~s" meta uri))
    (values
      (make-instance 'types:article-info
                     :id 0 :user 0 :title (get-title body)
                     :uri request :retrieved (get-universal-time)
                     :code code :meta meta)
                     :uri (if (quri:uri-p uri) (quri:render-uri uri) uri)
                     :retrieved (get-universal-time)
                     :code (smallnet.gemini:status->code status) :meta meta)
      body)))

M routes.lisp => routes.lisp +1 -1
@@ 29,7 29,7 @@
           (output-stream-p stream)))
   (:post (typecheck % (or null string)))
   (:documentation "Write an object OBJ to STREAM (or NIL to get a string returned), after adding a CRLF terminator."))
  (format stream "~a~a" obj gemini::+crlf+))
  (format stream "~a~a" obj smallnet::+crlf+))

(defun bad-path ()
  (write-line-crlf "51 Not found"))