summaryrefslogtreecommitdiff
path: root/test-suite/tests/web-uri.test
Commit message (Collapse)AuthorAgeFilesLines
* web: Accept URI host names consisting only of hex digits.Ludovic Courtès2020-06-181-1/+8
| | | | | | | | | | | | | Fixes <https://bugs.gnu.org/40582>. Reported by Julien Lepiller <julien@lepiller.eu>. Previously, a host part consisting of hex digits would be mistaken as an IPv6 address and rejected by 'valid-host?'. * module/web/uri.scm (ipv6-regexp): Add colon. * test-suite/tests/web-uri.test ("string->uri")["xyz://abc/x/y/z"]: New test. * NEWS: Update.
* Make URI handling locale independent.Timothy Sample2019-06-041-3/+30
| | | | | | | | | | | | Fixes <https://bugs.gnu.org/35785>. * module/web/uri.scm (digits, hex-digits, letters): New variables. (ipv4-regexp, ipv6-regexp, domain-label-regexp, top-label-regexp, userinfo-pat, host-pat, ipv6-host-pat, port-pat, scheme-pat): Explicitly list each character instead of using character ranges. * test-suite/tests/web-uri.test: Add corresponding tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* web: add support for URI-referenceAndy Wingo2017-05-211-3/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on a patch by Daniel Hartwig <mandyke@gmail.com>. * NEWS: Update. * doc/ref/web.texi (URIs): Fragments are properly part of a URI, so remove the incorrect note. Add documentation on URI subtypes. * module/web/uri.scm (uri-reference?): New base type predicate. (uri?, relative-ref?): Specific predicates. (validate-uri-reference): Strict validation. (validate-uri, validate-relative-ref): Specific validators. (build-uri-reference, build-relative-ref): New constructors. (string->uri-reference): Rename from string->uri. (string->uri, string->relative-ref): Specific constructors. (uri->string): Add #:include-fragment? keyword argument. * module/web/http.scm (parse-request-uri): Use `build-uri-reference', and result is a URI-reference, not URI, object. No longer infer an absent `uri-scheme' is `http'. (write-uri): Just use `uri->string'. (declare-uri-header!): Remove unused function. (declare-uri-reference-header!): Update. Rename from `declare-relative-uri-header!'. * test-suite/tests/web-uri.test ("build-uri-reference"): ("string->uri-reference"): Add. ("uri->string"): Also tests for relative-refs. * test-suite/tests/web-http.test ("read-request-line"): ("write-request-line"): Update for no scheme in some URIs. ("entity headers", "request headers"): Content-location, Referer, and Location should also parse relative-URIs. * test-suite/tests/web-request.test ("example-1"): Expect URI-reference with no scheme.
* Fix uri-decode behavior for "+"Andy Wingo2016-06-201-1/+4
| | | | | | | | | | | * module/web/uri.scm (uri-decode): Add #:decode-plus-to-space? keyword argument. (split-and-decode-uri-path): Don't decode plus to space. * doc/ref/web.texi (URIs): Update documentation. * test-suite/tests/web-uri.test ("decode"): Add tests. * NEWS: Add entry. Based on a patch by Brent <brent@tomski.co.za>.
* web: Location header is URI-reference; better URI-reference supportAndy Wingo2014-11-011-4/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* web: uri-encode hexadecimal percent-encoding is now uppercaseAleix Conchillo Flaque2013-05-021-2/+2
| | | | | | | | | | * module/web/uri.scm (uri-encode): the hexadecimal percent-encoding %HH is now uppercased as suggested by RFC3986: "For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings." * test-suite/tests/web-uri.test ("encode"): update tests.
* Fix uri-encoding for strings with no unreserved charsIan Price2012-08-261-1/+2
| | | | | | * module/web/uri.scm (uri-encode): Change test to check for unreserved chars instead of reserved chars. * test-suite/tests/web-uri.test ("encode"): Add test.
* Fix uri-encoding for octets 0-15Ian Price2012-08-261-1/+2
| | | | | | * module/web/uri.scm (uri-encode): All encoded octets should be of the form % HEXDIGIT HEXDIGIT. * test-suite/tests/web-uri.test ("encode"): Add test.
* disable some uri tests if --disable-networkingAndy Wingo2012-07-061-35/+38
| | | | | * test-suite/tests/web-uri.test: Disable some tests if we don't have inet-pton.
* more uri-related ipv6 fixesAndy Wingo2012-07-061-7/+7
| | | | | | | | | | | | | | * module/web/uri.scm (ipv6-regexp): IPv6 numeric addresses do not have brackets. It's only in URIs that they have them. (ipv6-host-pat, authority-regexp, parse-authority): Refactor ipv6 detection to fix a bug with |, and to extract IPv6 hosts from their brackets. This way we can pass the uri-host directly to inet-pton. (uri->string): If the host contains a `:', assume it is ipv6 and add brackets. * test-suite/tests/web-uri.test ("build-uri"): Adapt tests to assume that the address returned by uri-host and passed to build-uri #:host does not have brackets.
* enhance IPv6 supportDaniel Hartwig2012-07-061-4/+12
| | | | | | | * module/web/uri.scm (valid-host?): Support dotted-quad notation in IPv6 addresses. (parse-authority): Support IPv6 literals. * test-suite/tests/web-uri.test: Add and fix tests.
* support URIs with domain names starting with numbersDaniel Hartwig2012-07-061-1/+48
| | | | | | | * module/web/uri.scm (valid-host?): Fix regexp to support domain names starting with numbers. * test-suite/tests/web-uri.scm: Add tests for above and IP literals.
* add test for recent quick fixAndy Wingo2012-02-221-1/+5
| | | | | * test-suite/tests/web-uri.test ("string->uri"): Add test for string->uri with hosts beginning in digits.
* allow URIs of the form file:///etc/hostsAndy Wingo2011-12-061-2/+17
| | | | | | * module/web/uri.scm (parse-authority): Allow empty authorities, so that we accept URIs of the form, file:///etc/hosts. * test-suite/tests/web-uri.test ("string->uri"): Add tests.
* rename string->uri and uri->string.Andy Wingo2011-01-071-18/+18
| | | | | | | | * module/web/uri.scm (string->uri, uri->string): Rename from parse-uri and unparse-uri. * test-suite/tests/web-uri.test: * module/web/http.scm: All callers changed.
* URI parsing errors throw to `uri-error'Andy Wingo2010-11-041-19/+29
| | | | | | | * module/web/uri.scm (uri-error): New proc, throws to 'uri-error. (validate-uri, uri-decode, uri-encode): Use uri-error. * test-suite/tests/web-uri.test: Update for uri-error.
* web/uri: reimplement for rfc 3986, add testsAndy Wingo2010-10-171-0/+174
* module/web/uri.scm: Reimplement for RFC 3986. * module/Makefile.am: Add to build. * test-suite/Makefile.am: * test-suite/tests/web-uri.test: Add tests.