lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev (patch) fix cookies domains match case insensitively


From: Leonid Pauzner
Subject: lynx-dev (patch) fix cookies domains match case insensitively
Date: Mon, 5 Apr 1999 02:43:40 +0400 (MSD)

> On our corporate internet, we have a domain (MMIT-SMDB.mcit.com) which
> we often refer to as mmit-smdb.mcit.com within links. As we understand
> it, case sensitivity does NOT apply to domains, either should work. The
> problem comes in Lynx when cookies are of different case than the link;
> lynx apparently thinks they are different domains, and doesn't send the
> cookies back when it needs to. Once we isolated the main problem on the
> server side (we were redirecting to a login screen, capturing
> ID/password, sending cookies, then redirecting back to the protected
> page), and fixed it by making sure redirects were always lower case
> (consistent with the prevailing casing for the domain), the problem went
> away.

> The question, however, remains: domains should NOT be case sensitive,
> and cookies should ignore case on domain names when deciding whether to


* Cookies: domains now matches case insensitively
  (reported by  Paul Wagner <address@hidden>) - LP


diff -u old/lycookie.c ./lycookie.c
--- old/lycookie.c      Wed Mar 31 00:43:04 1999
+++ ./lycookie.c        Mon Apr  5 01:53:52 1999
@@ -211,7 +211,7 @@
      * The following line will handle both numeric IP addresses and
      * FQDNs.  Do numeric addresses require special handling?
      */
-    if (*B != '.' && !strcmp(A, B))
+    if (*B != '.' && !strcasecomp(A, B))
        return YES;

     /*
@@ -221,7 +221,7 @@
     if (*B == '.' && B[1] != '\0' && B[1] != '.' && *A != '.') {
        int diff = (strlen(A) - strlen(B));
        if (diff > 0) {
-           if (!strcmp((A + diff), B))
+           if (!strcasecomp((A + diff), B))
                return YES;
        }
     }
@@ -343,9 +343,9 @@
     }
     /*
      * The next 4 conditions do NOT apply if the domain is still
-     * the default of request-host.
+     * the default of request-host. (domains - case insensitive).
      */
-    if (strcmp(co->domain, hostname) != 0) {
+    if (strcasecomp(co->domain, hostname) != 0) {
        /*
         *  The hostname does not contain a dot.
         */
@@ -1074,9 +1074,10 @@
                     *  not an exact match to the hostname, nor
                     *  is a numeric IP address, add a lead dot.
                     *  Otherwise, use the value as is. - FM
+                    *  (domains - case insensitive).
                     */
                    if (value[0] != '.' && value[0] != '\0' &&
-                       value[1] != '\0' && strcmp(value, hostname)) {
+                       value[1] != '\0' && strcasecomp(value, hostname)) {
                        char *ptr = strchr(value, '.');
                        if (ptr != NULL && ptr[1] != '\0') {
                            ptr = value;
@@ -1575,9 +1576,10 @@
                     *  not an exact match to the hostname, nor
                     *  is a numeric IP address, add a lead dot.
                     *  Otherwise, use the value as is. - FM
+                    *  (domains - case insensitive).
                     */
                    if (value[0] != '.' && value[0] != '\0' &&
-                       value[1] != '\0' && strcmp(value, hostname)) {
+                       value[1] != '\0' && strcasecomp(value, hostname)) {
                        char *ptr = strchr(value, '.');
                        if (ptr != NULL && ptr[1] != '\0') {
                            ptr = value;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]