1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-20 23:34:40 +01:00

- fixed hex digit parsing from iri parser;

- added more debugging messages;

- fixed formatting.
This commit is contained in:
cage 2021-03-15 19:28:07 +01:00
parent b3c3d8a232
commit 0c2398c184
4 changed files with 21 additions and 16 deletions

View File

@ -413,19 +413,19 @@
(with-open-support-file (file-stream support-file)
(labels ((%fill-buffer ()
(when (downloading-allowed-p wrapper-object)
(multiple-value-bind (buffer read-so-far)
(read-array download-stream +read-buffer-size+)
(increment-bytes-count wrapper-object read-so-far)
(if (< read-so-far (length buffer))
(progn
(write-sequence buffer file-stream :start 0 :end read-so-far)
(force-output file-stream)
(setf (stream-status wrapper-object) :completed)
(gemini-client:close-ssl-socket socket)
(os-utils:xdg-open support-file))
(progn
(write-sequence buffer file-stream)
(%fill-buffer)))))))
(multiple-value-bind (buffer read-so-far)
(read-array download-stream +read-buffer-size+)
(increment-bytes-count wrapper-object read-so-far)
(if (< read-so-far (length buffer))
(progn
(write-sequence buffer file-stream :start 0 :end read-so-far)
(force-output file-stream)
(setf (stream-status wrapper-object) :completed)
(gemini-client:close-ssl-socket socket)
(os-utils:xdg-open support-file))
(progn
(write-sequence buffer file-stream)
(%fill-buffer)))))))
(%fill-buffer))))))
(defun request-success-dispatched-clrs (enqueue)

View File

@ -243,6 +243,7 @@
(let* ((header-raw (read-line-into-array stream :add-newline-stopper nil))
(header (babel:octets-to-string header-raw :errorp nil))
(parsed-header (parse-gemini-response-header (format nil "~a~a" header #\Newline))))
(debug-gemini (format nil "response header ~s" header))
(with-accessors ((meta meta)
(status-code status-code)) parsed-header
(flet ((results (code-class body)

View File

@ -110,7 +110,9 @@
(defrule pct-encoded (and "%" hexdig hexdig)
(:text t))
(defrule hexdig (or (character-ranges #\a #\f) digit)
(defrule hexdig (or (character-ranges (#\a #\f))
(character-ranges (#\A #\F))
digit)
(:text t))
(defrule ipv4-address (and dec-octet "." dec-octet "." dec-octet "." dec-octet)

View File

@ -44,8 +44,10 @@
(incf cpu-count)))))
(defun xdg-open (file)
(uiop:launch-program (format nil "~a '~a'" +xdg-open-bin+ file)
:output nil))
(let ((cmd-line (format nil "~a '~a'" +xdg-open-bin+ file)))
#+debug-mode
(misc:dbg "xdg-open: ~a" cmd-line)
(uiop:launch-program cmd-line :output nil)))
(defun getenv (name)
(nix:getenv name))