adapt to RFC terminology:
rename PARSE-HTTP-SERVERS-URL-FRAGMENT to PARSE-REQUEST-URI rename variable uri-string to request-uri
This commit is contained in:
parent
cd22ab11d4
commit
53e3e9672f
|
@ -206,7 +206,7 @@
|
||||||
;; (future) NOTE: With this, a redirection may change the
|
;; (future) NOTE: With this, a redirection may change the
|
||||||
;; protocol in use (currently, the server only supports one of
|
;; protocol in use (currently, the server only supports one of
|
||||||
;; it). This might be inapplicable.
|
;; it). This might be inapplicable.
|
||||||
(parse-http-servers-url-fragment new-location-uri socket options)))))
|
(parse-request-uri new-location-uri socket options)))))
|
||||||
|
|
||||||
(make-request "GET"
|
(make-request "GET"
|
||||||
new-location-uri
|
new-location-uri
|
||||||
|
@ -250,29 +250,29 @@
|
||||||
((3) (parse-http-version (caddr elts)))
|
((3) (parse-http-version (caddr elts)))
|
||||||
(else (fatal-syntax-error "Bad Request Line."))))
|
(else (fatal-syntax-error "Bad Request Line."))))
|
||||||
(meth (car elts))
|
(meth (car elts))
|
||||||
(uri-string (cadr elts))
|
(request-uri (cadr elts))
|
||||||
(url (parse-http-servers-url-fragment uri-string sock options))
|
(url (parse-request-uri request-uri sock options))
|
||||||
(headers (if (equal? version '(0 . 9))
|
(headers (if (equal? version '(0 . 9))
|
||||||
'()
|
'()
|
||||||
(read-rfc822-headers (socket:inport sock)))))
|
(read-rfc822-headers (socket:inport sock)))))
|
||||||
(make-request meth uri-string url version headers sock)))))
|
(make-request meth request-uri url version headers sock)))))
|
||||||
|
|
||||||
;;; Parse the URL, but if it begins without the "http://host:port"
|
;;; Parse the URI, but if it begins without the "http://host:port"
|
||||||
;;; prefix, interpolate one from SOCKET. It would be sleazier but
|
;;; prefix, interpolate one from SOCKET. It would be sleazier but
|
||||||
;;; faster if we just computed the default host and port at
|
;;; faster if we just computed the default host and port at
|
||||||
;;; server-startup time, instead of on every request.
|
;;; server-startup time, instead of on every request.
|
||||||
;;; REDIRECT-REQUEST relys on that nothing is read out from SOCKET.
|
;;; REDIRECT-REQUEST relys on that nothing is read out from SOCKET.
|
||||||
|
|
||||||
(define (parse-http-servers-url-fragment uri-string socket options)
|
(define (parse-request-uri request-uri socket options)
|
||||||
(receive (scheme path search frag-id) (parse-uri uri-string)
|
(receive (scheme path search frag-id) (parse-uri request-uri)
|
||||||
(if frag-id ; Can't have a #frag part.
|
(if frag-id ; Can't have a #frag part.
|
||||||
(fatal-syntax-error "HTTP URL contains illegal #<fragment> suffix."
|
(fatal-syntax-error "HTTP URL contains illegal #<fragment> suffix."
|
||||||
uri-string)
|
request-uri)
|
||||||
|
|
||||||
(if scheme
|
(if scheme
|
||||||
(if (string-ci=? scheme "http") ; Better be an http url.
|
(if (string-ci=? scheme "http") ; Better be an http url.
|
||||||
(parse-http-url path search #f)
|
(parse-http-url path search #f)
|
||||||
(fatal-syntax-error "Non-HTTP URL" uri-string))
|
(fatal-syntax-error "Non-HTTP URL" request-uri))
|
||||||
|
|
||||||
;; Interpolate the server struct from our net connection.
|
;; Interpolate the server struct from our net connection.
|
||||||
(if (and (pair? path) (string=? (car path) ""))
|
(if (and (pair? path) (string=? (car path) ""))
|
||||||
|
@ -289,7 +289,7 @@
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
(fatal-syntax-error "Path fragment must begin with slash"
|
(fatal-syntax-error "Path fragment must begin with slash"
|
||||||
uri-string))))))
|
request-uri))))))
|
||||||
|
|
||||||
|
|
||||||
(define parse-http-version
|
(define parse-http-version
|
||||||
|
|
Loading…
Reference in New Issue