mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 09:40:25 +02:00
web: Location header is URI-reference; better URI-reference support
* module/web/uri.scm (validate-uri): Add reference? keyword argument, for validating references. (build-uri): Clarify comments to indicate that the result is an absolute URI. (build-uri-reference): New interface, to build URI-references. (string->uri-reference): Rename from string->uri*. Fix fragment parsing to not include the #. (string->uri): Adapt to string->uri-reference name change. * module/web/request.scm (request-absolute-uri): Add default-scheme optional argument. Use it if the request-uri has no scheme, or error. * module/web/http.scm (write-uri): Reflow to use "when". Fix writing of URI-reference instances. (declare-uri-reference-header!): Rename from declare-relative-uri-header!. Use string->uri-reference. ("Location"): Declare as a URI-reference header, as per RFC 7231. * module/web/client.scm (open-socket-for-uri): Handle the case in which there is no URI scheme. * test-suite/tests/web-http.test: * test-suite/tests/web-uri.test: Add tests.
This commit is contained in:
parent
7f2c824551
commit
18c44b29e4
6 changed files with 421 additions and 49 deletions
|
@ -74,7 +74,8 @@
|
|||
(delete-duplicates
|
||||
(getaddrinfo (uri-host uri)
|
||||
(cond (port => number->string)
|
||||
(else (symbol->string (uri-scheme uri))))
|
||||
((uri-scheme uri) => symbol->string)
|
||||
(else (error "Not an absolute URI" uri)))
|
||||
(if port
|
||||
AI_NUMERICSERV
|
||||
0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue