diff --git a/src/gemini-viewer.lisp b/src/gemini-viewer.lisp index 9b76923..e3a266f 100644 --- a/src/gemini-viewer.lisp +++ b/src/gemini-viewer.lisp @@ -371,10 +371,10 @@ (ui:error-message (format nil (_ "Could not understand the address ~s") url)) - (let* ((host (uri:uri-host parsed-uri)) - (path (uri:uri-path parsed-uri)) - (query (uri:uri-query parsed-uri)) - (port (or (uri:uri-port parsed-uri) + (let* ((host (uri:host parsed-uri)) + (path (uri:path parsed-uri)) + (query (uri:query parsed-uri)) + (port (or (uri:port parsed-uri) gemini-client:+gemini-default-port+)) (actual-uri (gemini-parser:make-gemini-uri host path @@ -435,9 +435,9 @@ (flet ((on-input-complete (maybe-accepted) (when (ui::boolean-input-accepted-p maybe-accepted) (let ((new-url (gemini-parser:absolutize-link meta - (uri:uri-host parsed-uri) - (uri:uri-port parsed-uri) - (uri:uri-path parsed-uri)))) + (uri:host parsed-uri) + (uri:port parsed-uri) + (uri:path parsed-uri)))) (db-utils:with-ready-database (:connect nil) (request new-url :certificate-key certificate-key diff --git a/src/gemini/gemini-parser.lisp b/src/gemini/gemini-parser.lisp index 6b87e4a..2b2f391 100644 --- a/src/gemini/gemini-parser.lisp +++ b/src/gemini/gemini-parser.lisp @@ -171,7 +171,7 @@ (let ((parsed (or (ignore-errors (uri:uri-parse link-value)) (uri:make-uri nil nil nil nil link-value nil nil)))) (cond - ((null (uri:uri-host parsed)) + ((null (uri:host parsed)) (let* ((absolute-path-p (string-starts-with-p "/" link-value)) (path (if absolute-path-p link-value @@ -183,7 +183,7 @@ (uri:normalize-path path) nil original-port))) - ((null (uri:uri-scheme parsed)) + ((null (uri:scheme parsed)) (strcat +gemini-scheme+ ":" (to-s (uri:normalize-path parsed)))) (t @@ -217,7 +217,7 @@ (defun gemini-link-uri-p (uri) (conditions:with-default-on-error (nil) (or (text-utils:string-starts-with-p +gemini-scheme+ uri) - (null (uri:uri-scheme (uri:uri-parse uri)))))) + (null (uri:scheme (uri:uri-parse uri)))))) (defclass gemini-page-theme () ((link-prefix-gemini @@ -383,5 +383,5 @@ (let ((parsed (uri:uri-parse maybe-uri))) (and parsed (string-equal +gemini-scheme+ - (uri:uri-scheme parsed)) - (uri:uri-host parsed))))) + (uri:scheme parsed)) + (uri:host parsed))))) diff --git a/src/iri-parser.lisp b/src/iri-parser.lisp index 9e055a1..cc81bf7 100644 --- a/src/iri-parser.lisp +++ b/src/iri-parser.lisp @@ -215,8 +215,8 @@ (defclass iri (uri-parser:uri) ()) -(defmethod uri-parser:uri-host ((object iri)) - (let ((host (slot-value object 'uri-host))) +(defmethod uri-parser:host ((object iri)) + (let ((host (slot-value object 'host))) (if (text-utils:string-starts-with-p "[" host) (subseq host 1 (1- (length host))) host))) @@ -250,13 +250,13 @@ res))) (defun copy-iri (from) - (let ((scheme (uri:uri-scheme from)) - (user-info (uri:uri-user-info from)) - (host (slot-value from 'uri:uri-host)) - (port (uri:uri-port from)) - (path (uri:uri-path from)) - (query (uri:uri-query from)) - (fragment (uri:uri-fragment from))) + (let ((scheme (uri:scheme from)) + (user-info (uri:user-info from)) + (host (slot-value from 'uri:host)) + (port (uri:port from)) + (path (uri:path from)) + (query (uri:query from)) + (fragment (uri:fragment from))) (make-iri scheme user-info host @@ -268,13 +268,13 @@ (defun render-iri (iri &optional (stream *standard-output*)) (flet ((render () (with-output-to-string (string-stream) - (let ((scheme (uri:uri-scheme iri)) - (user-info (uri:uri-user-info iri)) - (host (slot-value iri 'uri-host)) - (port (uri:uri-port iri)) - (path (uri:uri-path iri)) - (query (uri:uri-query iri)) - (fragment (uri:uri-fragment iri))) + (let ((scheme (uri:scheme iri)) + (user-info (uri:user-info iri)) + (host (slot-value iri 'host)) + (port (uri:port iri)) + (path (uri:path iri)) + (query (uri:query iri)) + (fragment (uri:fragment iri))) (when scheme (format string-stream "~a:" scheme)) (write-string "//" string-stream) diff --git a/src/package.lisp b/src/package.lisp index 0eab074..8a30395 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -628,15 +628,14 @@ :uri :copy-uri :render-uri - :uri-p :uri-parse - :uri-scheme - :uri-user-info - :uri-host - :uri-port - :uri-path - :uri-query - :uri-fragment + :scheme + :user-info + :host + :port + :path + :query + :fragment :normalize-path :make-uri)) diff --git a/src/uri-parser.lisp b/src/uri-parser.lisp index 28f5982..34d8128 100644 --- a/src/uri-parser.lisp +++ b/src/uri-parser.lisp @@ -189,39 +189,39 @@ (defrule uri-reference (or uri relative-ref)) (defclass uri () - ((uri-scheme + ((scheme :initform nil :initarg :scheme - :accessor uri-scheme) - (uri-user-info + :accessor scheme) + (user-info :initform nil :initarg :user-info - :accessor uri-user-info) - (uri-host + :accessor user-info) + (host :initform nil :initarg :host - :writer (setf uri-scheme)) - (uri-port + :writer (setf host)) + (port :initform nil :initarg :port - :accessor uri-port) - (uri-path + :accessor port) + (path :initform nil :initarg :path - :accessor uri-path) - (uri-query + :accessor path) + (query :initform nil :initarg :query - :accessor uri-query) - (uri-fragment + :accessor query) + (fragment :initform nil :initarg :fragment - :accessor uri-fragment))) + :accessor fragment))) -(defgeneric uri-host (object)) +(defgeneric host (object)) -(defmethod uri-host ((object uri)) - (let ((host (slot-value object 'uri-host))) +(defmethod host ((object uri)) + (let ((host (slot-value object 'host))) (if (text-utils:string-starts-with-p "[" host) (subseq host 1 (1- (length host))) host))) @@ -255,13 +255,13 @@ res))) (defun copy-uri (from) - (let ((scheme (uri-scheme from)) - (user-info (uri-user-info from)) - (host (slot-value from 'uri-host)) - (port (uri-port from)) - (path (uri-path from)) - (query (uri-query from)) - (fragment (uri-fragment from))) + (let ((scheme (scheme from)) + (user-info (user-info from)) + (host (slot-value from 'host)) + (port (port from)) + (path (path from)) + (query (query from)) + (fragment (fragment from))) (make-uri scheme user-info host @@ -273,13 +273,13 @@ (defun render-uri (uri &optional (stream *standard-output*)) (flet ((render () (with-output-to-string (string-stream) - (let ((scheme (uri-scheme uri)) - (user-info (uri-user-info uri)) - (host (slot-value uri 'uri-host)) - (port (uri-port uri)) - (path (uri-path uri)) - (query (uri-query uri)) - (fragment (uri-fragment uri))) + (let ((scheme (scheme uri)) + (user-info (user-info uri)) + (host (slot-value uri 'host)) + (port (port uri)) + (path (path uri)) + (query (query uri)) + (fragment (fragment uri))) (when scheme (format string-stream "~a:" scheme)) (write-string "//" string-stream) @@ -299,10 +299,10 @@ (defmethod normalize-path ((object uri:uri)) - (let ((clean-path (normalize-path (uri:uri-path object))) + (let ((clean-path (normalize-path (uri:path object))) (copy (uri:copy-uri object))) (when clean-path - (setf (uri:uri-path copy) clean-path)) + (setf (uri:path copy) clean-path)) copy)) (defgeneric normalize-path (object))