Indentation and comment fixes. As usual, fix Olin's atrocious
line-breaking of IFs.
This commit is contained in:
parent
abc0cdb34d
commit
b85f09212e
|
@ -6,7 +6,7 @@
|
||||||
;;; For copyright information, see the file COPYING which comes with
|
;;; For copyright information, see the file COPYING which comes with
|
||||||
;;; the distribution.
|
;;; the distribution.
|
||||||
|
|
||||||
;;; I'm only implementing http URL's right now.
|
;;; I'm only implementing HTTP URL's right now.
|
||||||
|
|
||||||
;;; References:
|
;;; References:
|
||||||
;;; - http://www.w3.org/Addressing/rfc1738.txt
|
;;; - http://www.w3.org/Addressing/rfc1738.txt
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
;;; it wins. CADDR drops the userhost portion of the path. In fact,
|
;;; it wins. CADDR drops the userhost portion of the path. In fact,
|
||||||
;;; fatal-syntax-error is called, if the path doesn't start with '//'.
|
;;; fatal-syntax-error is called, if the path doesn't start with '//'.
|
||||||
|
|
||||||
|
;
|
||||||
(define (parse-userhost path default)
|
(define (parse-userhost path default)
|
||||||
(if (and (pair? path) ; The thing better begin
|
(if (and (pair? path) ; The thing better begin
|
||||||
(string=? (car path) "") ; with // (i.e., have two
|
(string=? (car path) "") ; with // (i.e., have two
|
||||||
|
@ -53,14 +54,12 @@
|
||||||
|
|
||||||
(let* ((uhs (caddr path)) ; Userhost string.
|
(let* ((uhs (caddr path)) ; Userhost string.
|
||||||
(uhs-len (string-length uhs))
|
(uhs-len (string-length uhs))
|
||||||
; Usr:passwd at-sign,
|
(at (string-index uhs #\@)) ; Usr:passwd at-sign, if any.
|
||||||
(at (string-index uhs #\@)) ; if any.
|
|
||||||
|
|
||||||
(colon1 (and at (string-index uhs #\:))) ; Usr:passwd colon,
|
(colon1 (and at (string-index uhs #\:))) ; Usr:passwd colon,
|
||||||
(colon1 (and colon1 (< colon1 at) colon1)) ; if any.
|
(colon1 (and colon1 (< colon1 at) colon1)) ; if any.
|
||||||
|
|
||||||
(colon2 (string-index uhs #\: (or at 0)))) ; Host:port colon,
|
(colon2 (string-index uhs #\: (or at 0)))) ; Host:port colon, if any.
|
||||||
; if any.
|
|
||||||
(make-userhost (if at
|
(make-userhost (if at
|
||||||
(unescape-uri uhs 0 (or colon1 at))
|
(unescape-uri uhs 0 (or colon1 at))
|
||||||
(userhost-user default))
|
(userhost-user default))
|
||||||
|
@ -90,9 +89,11 @@
|
||||||
;; Encode before assembly in case pieces contain colons or at-signs.
|
;; Encode before assembly in case pieces contain colons or at-signs.
|
||||||
(e (lambda (s) (escape-uri s userhost-escaped-chars)))
|
(e (lambda (s) (escape-uri s userhost-escaped-chars)))
|
||||||
|
|
||||||
(user/passwd (if us `(,(e us) . ,(if pw `(":" ,(e pw) "@") '("@")))
|
(user/passwd (if us
|
||||||
|
`(,(e us) . ,(if pw `(":" ,(e pw) "@") '("@")))
|
||||||
'()))
|
'()))
|
||||||
(host/port (if ho `(,(e ho) . ,(if po `(":" ,(e po)) '()))
|
(host/port (if ho
|
||||||
|
`(,(e ho) . ,(if po `(":" ,(e po)) '()))
|
||||||
'())))
|
'())))
|
||||||
|
|
||||||
(apply string-append (append user/passwd host/port))))
|
(apply string-append (append user/passwd host/port))))
|
||||||
|
|
Loading…
Reference in New Issue