shithub: riscv

Download patch

ref: ef5e19b9be94b07ac68711255d87a7e5b31a65a4
parent: 257c7e958ef125ec12cc218519ce56f767eb112d
author: cinap_lenrek <[email protected]>
date: Sat May 25 23:33:39 EDT 2013

add leading dot for explicit domain in webcookies, bump redirection limit to 12 in webfs

--- a/sys/src/cmd/webcookies.c
+++ b/sys/src/cmd/webcookies.c
@@ -953,9 +953,20 @@
 	}
 	*e = p;
 
-	if(c->dom)
+	if(c->dom){
+		/* add leading dot for explicit domain */
+		if(c->dom[0] != '.' && strcmp(ipattr(c->dom), "dom") == 0){
+			static char *ddom = nil;
+
+			ddom = realloc(ddom, strlen(c->dom)+2);
+			if(ddom != nil){
+				ddom[0] = '.';
+				strcpy(ddom+1, c->dom);
+				c->dom = ddom;
+			}
+		}
 		c->explicitdom = 1;
-	else
+	}else
 		c->dom = dom;
 	if(c->path)
 		c->explicitpath = 1;
--- a/sys/src/cmd/webfs/http.c
+++ b/sys/src/cmd/webfs/http.c
@@ -506,7 +506,7 @@
 	h = nil;
 	pid = 0;
 	needlength = 0;
-	for(try = 0; try < 6; try++){
+	for(try = 0; try < 12; try++){
 		strcpy(status, "0 No status");
 		if(u == nil || (strcmp(u->scheme, "http") && strcmp(u->scheme, "https"))){
 			werrstr("bad url scheme");