GNU bug report logs -
#12827
[2.0.6] web client: fails to parse 404 header
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Wed, 7 Nov 2012 20:42:02 UTC
Severity: normal
Done: Andy Wingo <wingo <at> pobox.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 24 November 2012 23:34, Daniel Hartwig <mandyke <at> gmail.com> wrote:
> The API seems less clean, and it is not immediately clear
> that uri? is not the top of the URI-like type hierarchy. The other
> functions only indicate “uri” in their name. I did not
> wish to introduce parallel “build-uri-reference”, etc. for each of
> these, and did consider adding #:reference? on some to select
> weaker validation.
>
> I think I prefer to keep the base type predicate as uri?, and use
> relative-ref? and absolute-uri? to distinguish. This would mean
> deviating from the RFC by:
> - permitting fragments in absolute-uri?;
> - not requiring a scheme in uri?;
>
> which are both forgivable.
>
> Maybe I am just too fussy!
Hello now
Revisting this old thread, I have complete the bulk of the work now.
Attached are a few patches to generally clean up the web modules a
bit, followed by a larger one introducing the promised relative URI
support.
* Terminology
The terminology used in latest URI spec. (RFC 3986) is not widely used
elsewhere. Not by Guile, not by the HTTP spec., or other sources.
Specifically, it defines these terms:
- URI: scheme rest ... [fragment]
- Absolute-URI: scheme rest ... [fragment]
- Relative-Ref: rest ... [fragment]
- URI-Reference: Absolute-URI | Relative-Ref
where as HTTP and other sources use the terms from an earlier URI
spec. (RFC 2396):
- Absolute-URI: scheme rest ... [fragment]
- Relative-URI: rest ... [fragment]
- URI, URI-Reference: Absolute-URI | Relative-URI
With this patch I have opted to use the later, more common terms.
This has the advantage of not requiring massive renaming or
duplicating of most procedures to include, e.g.
‘uri-reference-scheme’, as we just use the term ‘uri’ to refer to
either type.
If this is undesired, it can easily be reworked to use the terminology
from RFC 3986.
* API compatability
Presently, all APIs work only with absolute URIs. You can not use
string->uri or build-uri to produce any relative URIs, neither are
other procedures (generally) expected to work correctly if given them.
What we have in this patch is that <uri> grows to encompass both
relative and absolute URIs. ‘uri?’ is a general type predicate,
‘build-uri’ will produce and validate either type, and there are pairs
of converters and predicates to distinguish between relative and
absolute.
Effectively, a pseudo-type heirarchy, with uri? at the top and
absolute-uri? and relative-uri? beneath it.
* To be done
Barely touched request, response, client, or server modules. Though
these will continue to work with current usage patterns and I have
added some notes about future work.
Also, I believe it will pay to extend http-get et. al to accept a
relative URI with separate Host header or keyword option. Also allow
write-request-line to display exactly the URI passed to it, rather
than always chopping off the scheme and host (e.g. the HTTP spec.
allows such lines and they are require to write some types of proxy
software).
Coming along soon is a procedure to resolve a relative URI against a
base, absolute URI. The same algorithm documented in the RFC.
Regards
[0001-minor-tweaks-to-web-documentation.patch (application/octet-stream, attachment)]
[0002-web-public-access-to-default-port-information.patch (application/octet-stream, attachment)]
[0003-add-tests-for-read-request-line-etc.patch (application/octet-stream, attachment)]
[0004-extend-support-for-relative-URIs-to-public-interface.patch (application/octet-stream, attachment)]
This bug report was last modified 8 years and 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.