Fixed test 539 to handle an out of memory condition that shows up now
authorDan Fandrich <dan@coneharvesters.com>
Mon, 22 Sep 2008 17:20:29 +0000 (17:20 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Mon, 22 Sep 2008 17:20:29 +0000 (17:20 +0000)
that memdebug.h is included in the test programs.

CHANGES
tests/libtest/lib539.c

diff --git a/CHANGES b/CHANGES
index efc64d9..8104500 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Fandrich (22 Sep 2008)
+- Fixed test 539 to handle an out of memory condition that shows up now
+  that memdebug.h is included in the test programs.
+
 Yang Tse (20 Sep 2008)
 - Fix regression in configure script which affected OpenSSL builds on MSYS.
 
@@ -68,14 +72,15 @@ Daniel Stenberg (8 Sep 2008)
   the cookie to not match.
 
 Daniel Fandrich (5 Sep 2008)
-- Improved the logic the decides whether to use HTTP 1.1 features or not in a
+- Improved the logic that decides whether to use HTTP 1.1 features or not in a
   request.  Setting a specific version with CURLOPT_HTTP_VERSION overrides
   all other checks, but otherwise, a 1.0 request will be made if the server
   is known to support only 1.0 because it previously responded so and the
   connection was kept alive, or a response to a previous request on this handle
   came back as 1.0. The latter could take place in cases like redirection or
   authentication where several requests have to be made before the operation
-  is complete.
+  is complete.  If any one of the servers in a redirection chain supports only
+  1.0, then remaining requests will be sent in 1.0 mode.
 
 - Detect cases where an upload must be sent chunked and the server supports
   only HTTP 1.0 and return CURLE_UPLOAD_FAILED.
index c993444..eda78fc 100644 (file)
@@ -35,7 +35,7 @@ int test(char *URL)
     */
    curl_easy_setopt(curl, CURLOPT_URL, URL);
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
-   curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
+   curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
 
    res = curl_easy_perform(curl);
 
@@ -47,13 +47,24 @@ int test(char *URL)
     * even though no directories are stored in the ftpconn->dirs array (after a
     * call to freedirs).
     */
-   newURL = strcat (strcpy ((char*)malloc (strlen (URL) + 3),
-                            URL),
-                    "./");
+   newURL = malloc(strlen(URL) + 3);
+   if (newURL == NULL) {
+     curl_easy_cleanup(curl);
+     curl_global_cleanup();
+     return TEST_ERR_MAJOR_BAD;
+   }
+   newURL = strcat(strcpy(newURL, URL), "./");
+
    slist = curl_slist_append (NULL, "SYST");
+   if (slist == NULL) {
+     free(newURL);
+     curl_easy_cleanup(curl);
+     curl_global_cleanup();
+     return TEST_ERR_MAJOR_BAD;
+   }
 
    curl_easy_setopt(curl, CURLOPT_URL, newURL);
-   curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+   curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
    curl_easy_setopt(curl, CURLOPT_QUOTE, slist);
 
    res = curl_easy_perform(curl);