Commits


iri: always output file:// urls with the `//' separator


iri: rework iri_unparse() I'm not actually pround of the %s%s%s%s%s%s... etc, but it works fine. There's no need to do further escaping here, since consuming code is not supposed to reach inside the iri struct. It'll be made opaque maybe in the future.


fix handling of gopher selectors Much of telescope works in terms of URI, so we convert each gopher link to an URI. However, we didn't urlencode the path parameter, thus failing on every link that contains spaces or similar invalid (in URI paths) characters. Issue reported by hryjksn on github, thanks! https://github.com/omar-polo/telescope/issues/14


iri: fix parse_path_absolute with path being "/" it was mis-parsed as "" causing failures when resolving a relative URI.


iri: add iri_setport() takes a string because the internals of telescope makes it easier to use if a string.


iri_setquery: avoid needless else block


add missing #include "compat.h"


iri: refactor parse_{query,fragment} into a single function


iri: copy portstr too


iri: make mergepath take a buffer and strings, not the iri pointers


iri: change remove_dot_segmens to take a buffer instead of an iri


iri: zero iri_flags before parsing


iri: use a temp buffer for %enc in iri_setquery


iri: implement iri_setquery


iri: fix port parsing


iri: support framents and enable fragments tests


iri: rewrite remove_dot_segments to be clearer the previous version was straight out RFC3986 (more or less, it had a bug I didn't spot), but it's ugly and extremely long. Rewrite it to be somewhat inspired by canonpath (from kern_pledge.c) and way simpler. There are some small differences in how UNIX paths and URLs paths are canonized (in UNIX path you don't care too much of a trailing '/', in URLs you do.) The new code is more clear and passes all the tests in RFC3986, so I'm calling it a win.


iri: fix remove_dot_segments algorithm i've misread the description in the RFC; we should copy up to, but not including, the next '/' at the end and manually inject some '/' in some other cases.


iri: fix remove_dot_segments: should copy until (including) "/"


iri: fix typo: should check the first two characters, not three


iri: fix path check path should *start* with "/" to enter that branch, not be exactly "/".


iri: fix logic in iri_unparse make sure path starts with "/" only when there's an authority part, not when it's not there!


iri: drop extraneous cpfields(IH_QUERY)


iri: set some flags as defined only when actually copying


iri: draft iri_unparse