shithub: castor9

Download patch

ref: 1e9ebfb3aec50a18bfaec8da2a96b9604e40ca18
parent: 897c1238599c245a3d499283a51605e410021149
author: Julien Blanchard <julien@typed-hole.org>
date: Fri Dec 18 06:20:33 EST 2020

Fix absolute URLs parsing and mailto

--- a/castor.c
+++ b/castor.c
@@ -606,6 +606,8 @@
 		next_url = urlparse(nil, link);
 	}else if(strbeg(link, "//") == 0){
 		next_url = urlparse(nil, smprint("gemini:%s", link));
+	}else if(strbeg(link, "mailto:") == 0){
+		next_url = urlparse(nil, link);
 	}else{
 		/* assuming relative URL */
 		if(strcmp(link, "/") == 0){
@@ -613,7 +615,7 @@
 		}else if(*link == '/'){
 			n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link)+1);
 		}else{
-			n = estrdup(link);
+			n = smprint("%s%s", urlparse(current_base_url, link)->raw, estrdup(link));
 		}
 		next_url = urlparse(nil, n);
 	}