*** url.c.old Fri May 24 03:22:24 2002 --- url.c.new Sat Nov 22 12:38:15 2003 *************** mkstruct (const struct url *u) *** 1253,1260 **** --- 1253,1262 ---- dir = reencode_string (dir_preencoding); l = strlen (dir); + #if 0 if (l && dir[l - 1] == '/') dir[l - 1] = '\0'; + #endif if (!*u->file) file = "index.html"; *************** mkstruct (const struct url *u) *** 1265,1271 **** res = (char *)xmalloc (strlen (dir) + 1 + strlen (file) + (query ? (1 + strlen (query)) : 0) + 1); ! sprintf (res, "%s%s%s", dir, *dir ? "/" : "", file); if (query) { #if WINDOWS || __CYGWIN__ --- 1267,1273 ---- res = (char *)xmalloc (strlen (dir) + 1 + strlen (file) + (query ? (1 + strlen (query)) : 0) + 1); ! sprintf (res, "%s%s", dir, file); if (query) { #if WINDOWS || __CYGWIN__ *************** path_simplify (char *path) *** 1517,1522 **** --- 1519,1525 ---- } else if (*p == '/') { + #if 0 /* Remove empty path elements. Not mandated by rfc1808 et al, but empty path elements are not all that useful, and the rest of Wget might not deal with them well. */ *************** path_simplify (char *path) *** 1532,1537 **** --- 1535,1541 ---- memmove (p, q, end - q); end -= q - p; goto again; + #endif } /* Skip to the next path element. */ *************** uri_merge_1 (const char *base, const cha *** 1701,1706 **** --- 1705,1711 ---- int span; const char *start_insert; const char *last_slash = find_last_char (base, end, '/'); + const char *first_slash = memchr (base, '/', end-base); if (!last_slash) { /* No slash found at all. Append LINK to what we have, *************** uri_merge_1 (const char *base, const cha *** 1722,1728 **** start_insert = end + 1; need_explicit_slash = 1; } ! else if (last_slash && last_slash != base && *(last_slash - 1) == '/') { /* example: http://host" */ /* ^ */ --- 1727,1733 ---- start_insert = end + 1; need_explicit_slash = 1; } ! else if (last_slash && first_slash + 1 == last_slash) { /* example: http://host" */ /* ^ */