Skip to content

Commit

Permalink
Set port to scheme default in parse-uri-string.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambrevar committed Feb 16, 2021
1 parent b80c0da commit 45bfe31
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/parser.lisp
Expand Up @@ -2,6 +2,7 @@
(defpackage quri.parser
(:use :cl
:quri.error
:quri.port
:quri.util)
#+(or sbcl openmcl cmu allegro)
(:import-from #+sbcl :sb-cltl2
Expand Down Expand Up @@ -122,15 +123,18 @@
(setq userinfo (subseq (the string data) (the fixnum userinfo-start) (the fixnum userinfo-end))))
(unless (= host-start host-end)
(setq host (subseq data host-start host-end)))
(when port-start
(locally (declare (type fixnum port-start port-end))
(unless (= port-start port-end)
(handler-case
(setq port
(parse-integer data :start (the fixnum port-start) :end (the fixnum port-end)))
(error ()
(error 'uri-invalid-port
:data data :position port-start))))))))
(cond
(port-start
(locally (declare (type fixnum port-start port-end))
(unless (= port-start port-end)
(handler-case
(setq port
(parse-integer data :start (the fixnum port-start) :end (the fixnum port-end)))
(error ()
(error 'uri-invalid-port
:data data :position port-start))))))
(scheme
(setq port (scheme-default-port scheme))))))
(locally (declare (optimize (safety 0)))
(parse-from-path data (or port-end host-end (1+ end))))))))))
(values scheme userinfo host port path query fragment)))
Expand Down

0 comments on commit 45bfe31

Please sign in to comment.