]> sjero.net Git - wget/blobdiff - src/url.c
[svn] Fix #20747: Wget was returning error for non-recursive --spider when file exists.
[wget] / src / url.c
index e95d572ff05377e5b518aa4353675e882e6acd2a..04ecb3a4f3429170bf0c574df531264edcb77023 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1,5 +1,5 @@
 /* URL handling.
-   Copyright (C) 1996-2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2007 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -1369,7 +1369,7 @@ append_uri_pathel (const char *b, const char *e, bool escaped,
       || opt.restrict_files_case == restrict_uppercase)
     {
       char *q;
-      for (q = TAIL (dest); *q; ++q)
+      for (q = TAIL (dest); q < TAIL (dest) + outlen; ++q)
         {
           if (opt.restrict_files_case == restrict_lowercase)
             *q = TOLOWER (*q);
@@ -1836,7 +1836,7 @@ url_string (const struct url *url, enum url_auth_mode auth_mode)
           quoted_user = url_escape_allow_passthrough (url->user);
           if (url->passwd)
             {
-              if (auth_mode = URL_AUTH_HIDE_PASSWD)
+              if (auth_mode == URL_AUTH_HIDE_PASSWD)
                 quoted_passwd = HIDDEN_PASSWORD;
               else
                 quoted_passwd = url_escape_allow_passthrough (url->passwd);
@@ -2089,6 +2089,7 @@ test_append_uri_pathel()
       
       append_string (test_array[i].original_url, &dest);
       append_uri_pathel (p, p + strlen(p), test_array[i].escaped, &dest);
+      append_char ('\0', &dest);
 
       mu_assert ("test_append_uri_pathel: wrong result", 
                  strcmp (dest.base, test_array[i].expected_result) == 0);