commit ae2ad03ec0ae5f2300472239eb48f3e23d467fe2 from: Omar Polo date: Wed Nov 18 08:32:07 2020 UTC handle //example.com urls commit - 721e2325296b1556eb0d2224ef37b387091dff43 commit + ae2ad03ec0ae5f2300472239eb48f3e23d467fe2 blob - aa9a687625b4185962c750cd2190877096e3b043 blob + 217661d06130dc8766a433b0ec1618acedade1a1 --- ChangeLog +++ ChangeLog @@ -1,3 +1,8 @@ +2020-11-18 Omar Polo + + * gmid.c (url_after_proto): correct url parsing: accept URLs + without explicit protocol + 2020-11-17 Omar Polo * gmid.c (main): add flag -p to change the port blob - 87a4a622f653d350c159d42ba91c6265129d3fd7 blob + d0f03a7db9ba906f262702ffaf33398ee0d23b13 --- gmid.c +++ gmid.c @@ -172,11 +172,18 @@ url_after_proto(char *url) { char *s; const char *proto = "gemini"; - const char *marker = "://"; + const char *marker = "//"; /* a relative URL */ if ((s = strstr(url, marker)) == NULL) return url; + + /* + * if a protocol is not specified, gemini should be implied: + * this handles the case of //example.com + */ + if (s == url) + return s + strlen(marker); if (s - strlen(proto) != url) return NULL; @@ -184,7 +191,6 @@ url_after_proto(char *url) if (!starts_with(url, proto)) return NULL; - /* a valid gemini:// URL */ return s + strlen(marker); }