@@ 602,19 602,24 @@ texthit(Panel *p, int b, Rtext *rt)
if(link==nil)
return;
- if(strbeg(link, "gemini://") == 0){
+ if(strbeg(link, "gemini://") == 0){ /* gemini absolute */
next_url = urlparse(nil, link);
- }else if(strbeg(link, "//") == 0){
+ }else if(strstr(link, "://") != 0){ /* other protocol absolute */
+ next_url = urlparse(nil, link);
+ }else if(strbeg(link, "//") == 0){ /* schemeless so gemini */
next_url = urlparse(nil, smprint("gemini:%s", link));
- }else if(strbeg(link, "mailto:") == 0){
+ }else if(strbeg(link, "mailto:") == 0){ /* mailto: */
next_url = urlparse(nil, link);
}else{
/* assuming relative URL */
if(strcmp(link, "/") == 0){
+ /* no slash, must be a hostname */
n = smprint("gemini://%s", current_base_url->host);
}else if(*link == '/'){
+ /* start with a slash so skip it (+1) */
n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link)+1);
}else{
+ /* make an absolute URL of the link */
n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link));
}
next_url = urlparse(nil, n);