about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2009-11-25 01:40:15 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2009-11-25 01:40:15 -0500
commitf103148757c48f1227c4700d081e7e5dd6f592c8 (patch)
treef4c0a90322597763404ab3e3ee4746d366642f84
parent99d74890011b0327f07e7d827e5f93a929115ad4 (diff)
downloadlynx-snapshots-f103148757c48f1227c4700d081e7e5dd6f592c8.tar.gz
snapshot of project "lynx", label v2-8-8dev_1d
-rw-r--r--CHANGES4
-rw-r--r--src/LYCookie.c27
2 files changed, 22 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index efca62f0..d779f197 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,11 @@
--- $LynxId: CHANGES,v 1.458 2009/11/24 00:03:22 tom Exp $
+-- $LynxId: CHANGES,v 1.459 2009/11/25 01:40:15 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
 2009-11-?? (2.8.8dev.2)
+* modify trimming of URI in LYSetCookie() to eliminate trimming of final leaf
+  (Debian #460108) -TD
 * document the various xxx_PATH settings in lynx.cfg -TD
 * modify cfg2html.pl to improve formatting of cattoc.html -TD
 * split-up top-level makefile install-html rule to allow generating the htmlized
diff --git a/src/LYCookie.c b/src/LYCookie.c
index ceb9630a..6426c55e 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCookie.c,v 1.96 2009/11/24 10:48:33 tom Exp $
+ * $LynxId: LYCookie.c,v 1.97 2009/11/25 01:26:49 tom Exp $
  *
  *			       Lynx Cookie Support		   LYCookie.c
  *			       ===================
@@ -1760,17 +1760,28 @@ void LYSetCookie(const char *SetCookie,
     } else if (isHTTPS_URL(address)) {
 	port = 443;
     }
-    if (((path = HTParse(address, "",
-			 PARSE_PATH | PARSE_PUNCTUATION)) != NULL) &&
-	(ptr = strrchr(path, '/')) != NULL) {
-	if (ptr == path) {
-	    ++ptr;		/* Leave a single '/' alone */
+
+    /*
+     * Get the path from the request URI.
+     */
+    if ((path = HTParse(address, "", PARSE_PATH | PARSE_PUNCTUATION)) != NULL) {
+	/*
+	 * Trim off any parameters to provide something that we can compare
+	 * against the cookie's path for verifying if it has the proper prefix.
+	 */
+	if ((ptr = strchr(path, '?')) != NULL) {
+	    CTrace((tfp, "discarding params \"%s\" in request URI\n", ptr));
+	    *ptr = '\0';
 	}
-	if (*ptr != '\0') {
-	    CTrace((tfp, "discarding \"%s\" in cookie-path\n", ptr));
+	/* trim a trailing slash, unless we have only a "/" */
+	if ((ptr = strrchr(path, '/')) != NULL &&
+	    (ptr != path) &&
+	    ptr[1] == '\0') {
+	    CTrace((tfp, "discarding trailing \"/\" in request URI\n"));
 	    *ptr = '\0';
 	}
     }
+
     if (isEmpty(SetCookie) &&
 	isEmpty(SetCookie2)) {
 	/*