failf() calls should not have newlines in the message string!
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Dec 2001 13:13:01 +0000 (13:13 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Dec 2001 13:13:01 +0000 (13:13 +0000)
lib/connect.c
lib/dict.c
lib/ftp.c
lib/http.c
lib/krb4.c
lib/security.c
lib/sendf.c
lib/ssluse.c

index 69308df..9f8efdb 100644 (file)
@@ -284,7 +284,7 @@ static CURLcode bindlocal(struct connectdata *conn,
             failf(data, "Insufficient kernel memory was available: %d", errno);
             break;
           default:
-            failf(data, "errno %d\n", errno);
+            failf(data, "errno %d", errno);
             break;
           } /* end of switch(errno) */
        
index bbb5fe1..79b5a77 100644 (file)
@@ -121,7 +121,7 @@ CURLcode Curl_dict(struct connectdata *conn)
     }
       
     if ((word == NULL) || (*word == (char)0)) {
-      failf(data, "lookup word is missing\n");
+      failf(data, "lookup word is missing");
     }
     if ((database == NULL) || (*database == (char)0)) {
       database = (char *)"!";
@@ -174,7 +174,7 @@ CURLcode Curl_dict(struct connectdata *conn)
     }
       
     if ((word == NULL) || (*word == (char)0)) {
-      failf(data, "lookup word is missing\n");
+      failf(data, "lookup word is missing");
     }
     if ((database == NULL) || (*database == (char)0)) {
       database = (char *)"!";
index 7091e9f..ce566eb 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1634,7 +1634,7 @@ CURLcode ftp_perform(struct connectdata *conn)
 
           passed += actuallyread;
           if(actuallyread != readthisamountnow) {
-            failf(data, "Could only read %d bytes from the input\n", passed);
+            failf(data, "Could only read %d bytes from the input", passed);
             return CURLE_FTP_COULDNT_USE_REST;
           }
         }
index f1d3fb3..ffb4420 100644 (file)
@@ -449,7 +449,7 @@ CURLcode Curl_http_done(struct connectdata *conn)
   if(0 == (http->readbytecount + conn->headerbytecount)) {
     /* nothing was read from the HTTP server, this can't be right
        so we return an error here */
-    failf(data, "Empty reply from server\n");
+    failf(data, "Empty reply from server");
     return CURLE_GOT_NOTHING;
   }
 
@@ -610,7 +610,7 @@ CURLcode Curl_http(struct connectdata *conn)
 
         passed += actuallyread;
         if(actuallyread != readthisamountnow) {
-          failf(data, "Could only read %d bytes from the input\n",
+          failf(data, "Could only read %d bytes from the input",
                 passed);
           return CURLE_READ_ERROR;
         }
@@ -621,7 +621,7 @@ CURLcode Curl_http(struct connectdata *conn)
         data->set.infilesize -= conn->resume_from;
 
         if(data->set.infilesize <= 0) {
-          failf(data, "File already completely uploaded\n");
+          failf(data, "File already completely uploaded");
           return CURLE_PARTIAL_FILE;
         }
       }
@@ -793,7 +793,7 @@ CURLcode Curl_http(struct connectdata *conn)
       char contentType[256];
       int linelength=0;
       if(Curl_FormInit(&http->form, http->sendit)) {
-        failf(data, "Internal HTTP POST error!\n");
+        failf(data, "Internal HTTP POST error!");
         return CURLE_HTTP_POST_ERROR;
       }
 
@@ -824,7 +824,7 @@ CURLcode Curl_http(struct connectdata *conn)
                                            1,
                                            (FILE *)&http->form);
         if(linelength == -1) {
-          failf(data, "Could not get Content-Type header line!\n");
+          failf(data, "Could not get Content-Type header line!");
           return CURLE_HTTP_POST_ERROR;
         }
         add_buffer(req_buffer, contentType, linelength);
index 96cc452..9b752af 100644 (file)
@@ -374,7 +374,7 @@ void Curl_krb_kauth(struct connectdata *conn)
   memset(schedule, 0, sizeof(schedule));
   memset(passwd, 0, sizeof(passwd));
   if(Curl_base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) {
-    failf(conn->data, "Out of memory base64-encoding.\n");
+    failf(conn->data, "Out of memory base64-encoding.");
     Curl_set_command_prot(conn, save);
     return;
   }
index 2a92d0b..1be54c8 100644 (file)
@@ -362,11 +362,11 @@ Curl_sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap
                                conn);
     free(buf);
     if(len < 0) {
-       failf(conn->data, "Failed to encode command.\n");
+       failf(conn->data, "Failed to encode command.");
        return -1;
     }
     if(Curl_base64_encode(enc, len, &buf) < 0){
-      failf(conn->data, "Out of memory base64-encoding.\n");
+      failf(conn->data, "Out of memory base64-encoding.");
       return -1;
     }
     if(conn->command_prot == prot_safe)
@@ -421,7 +421,7 @@ sec_prot_internal(struct connectdata *conn, int level)
       return -1;
 
     if(conn->data->state.buffer[0] != '2'){
-      failf(conn->data, "Failed to set protection buffer size.\n");
+      failf(conn->data, "Failed to set protection buffer size.");
       return -1;
     }
     conn->buffer_size = s;
@@ -441,7 +441,7 @@ sec_prot_internal(struct connectdata *conn, int level)
     return -1;
 
   if(conn->data->state.buffer[0] != '2'){
-    failf(conn->data, "Failed to set protection level.\n");
+    failf(conn->data, "Failed to set protection level.");
     return -1;
   }
     
index 2a0aa78..ae4ce67 100644 (file)
@@ -137,8 +137,9 @@ void Curl_infof(struct SessionHandle *data, const char *fmt, ...)
   }
 }
 
-/* Curl_failf() is for messages stating why we failed, the LAST one will be
-   returned for the user (if requested) */
+/* Curl_failf() is for messages stating why we failed.
+ * The message SHALL NOT include any LF or CR.
+ */
 
 void Curl_failf(struct SessionHandle *data, const char *fmt, ...)
 {
index b167bfd..df891e2 100644 (file)
@@ -201,7 +201,7 @@ int cert_stuff(struct connectdata *conn,
     if (SSL_CTX_use_certificate_file(conn->ssl.ctx,
                                     cert_file,
                                     SSL_FILETYPE_PEM) != 1) {
-      failf(data, "unable to set certificate file (wrong password?)\n");
+      failf(data, "unable to set certificate file (wrong password?)");
       return(0);
     }
     if (key_file == NULL)
@@ -210,7 +210,7 @@ int cert_stuff(struct connectdata *conn,
     if (SSL_CTX_use_PrivateKey_file(conn->ssl.ctx,
                                    key_file,
                                    SSL_FILETYPE_PEM) != 1) {
-      failf(data, "unable to set public key file\n");
+      failf(data, "unable to set public key file");
       return(0);
     }
     
@@ -229,7 +229,7 @@ int cert_stuff(struct connectdata *conn,
     /* Now we know that a key and cert have been set against
      * the SSL context */
     if (!SSL_CTX_check_private_key(conn->ssl.ctx)) {
-      failf(data, "Private key does not match the certificate public key\n");
+      failf(data, "Private key does not match the certificate public key");
       return(0);
     }
 #ifndef HAVE_USERDATA_IN_PWD_CALLBACK    
@@ -578,7 +578,7 @@ Curl_SSLConnect(struct connectdata *conn)
   if(data->set.ssl.cipher_list) {
     if (!SSL_CTX_set_cipher_list(conn->ssl.ctx,
                                  data->set.ssl.cipher_list)) {
-      failf(data, "failed setting cipher list\n");
+      failf(data, "failed setting cipher list");
       return CURLE_SSL_CONNECT_ERROR;
     }
   }
@@ -591,7 +591,7 @@ Curl_SSLConnect(struct connectdata *conn)
     if (!SSL_CTX_load_verify_locations(conn->ssl.ctx,
                                        data->set.ssl.CAfile,
                                        data->set.ssl.CApath)) {
-      failf(data,"error setting cerficate verify locations\n");
+      failf(data,"error setting cerficate verify locations");
       return CURLE_SSL_CONNECT_ERROR;
     }
   }
@@ -713,7 +713,7 @@ Curl_SSLConnect(struct connectdata *conn)
   if(data->set.ssl.verifypeer) {
     data->set.ssl.certverifyresult=SSL_get_verify_result(conn->ssl.handle);
     if (data->set.ssl.certverifyresult != X509_V_OK) {
-      failf(data, "SSL certificate verify result: %d\n",
+      failf(data, "SSL certificate verify result: %d",
             data->set.ssl.certverifyresult);
       retcode = CURLE_SSL_PEER_CERTIFICATE;
     }