]> granicus.if.org Git - curl/commitdiff
Feng Tu reported that curl -w did wrong on TFTP transfers in
authorDaniel Stenberg <daniel@haxx.se>
Fri, 18 May 2007 10:32:48 +0000 (10:32 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 18 May 2007 10:32:48 +0000 (10:32 +0000)
bug report #1715394 (http://curl.haxx.se/bug/view.cgi?id=1715394), and the
transfer-related info "variables" were indeed overwritten with zeroes wrongly
and have now been adjusted. The upload size still isn't accurate.

CHANGES
RELEASE-NOTES
lib/tftp.c
lib/transfer.c

diff --git a/CHANGES b/CHANGES
index eb19f401c135ffa60b721314eeb6fc211dc738cc..af7271c0ed1dac3752816172adb9a873fc01be8e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,9 +5,16 @@
                              \___|\___/|_| \_\_____|
 
                                   Changelog
+Daniel S (18 May 2007)
+- Feng Tu reported that curl -w did wrong on TFTP transfers in 
+  bug report #1715394 (http://curl.haxx.se/bug/view.cgi?id=1715394), and the
+  transfer-related info "variables" were indeed overwritten with zeroes wrongly
+  and have now been adjusted. The upload size still isn't accurate.
+
 Daniel S (17 May 2007)
 - Feng Tu pointed out a division by zero error in the TFTP connect timeout
   code for timeouts less than five seconds, and also provided a fix for it.
+  Bug report #1715392 (http://curl.haxx.se/bug/view.cgi?id=1715392)
 
 Dan F (16 May 2007)
 - Added support for compiling under Minix 3.1.3 using ACK.
index a99410c8c262ba50d4eaa44f8cc6f0ca31ac5c31..0bb7221c3e09332ccfe69cc90bccd6f82a1b2a1e 100644 (file)
@@ -5,7 +5,7 @@ Curl and libcurl 7.16.3
  Available command line options:           118
  Available curl_easy_setopt() options:     141
  Number of public functions in libcurl:    54
- Amount of public web site mirrors:        39
+ Amount of public web site mirrors:        38
  Number of known libcurl bindings:         35
  Number of contributors:                   554
 
@@ -44,6 +44,7 @@ This release includes the following bugfixes:
  o overwriting an uploaded file with sftp now truncates it first
  o SFTP quote commands chmod, chown, chgrp can now set a value of 0
  o TFTP connect timouts less than 5 seconds
+ o improved curl -w for TFTP transfers
 
 This release includes the following known bugs:
 
index 038306d861faacc6515caed8b5d83e535b1d9f96..9104d605c4c5dac56f042a7e7dcae7b1b2baa75b 100644 (file)
@@ -415,8 +415,6 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
     return CURLE_TFTP_ILLEGAL; /* not really the perfect return code for
                                   this */
   }
-  Curl_pgrsSetDownloadCounter(data,
-                              (curl_off_t) state->block*TFTP_BLOCKSIZE);
   return CURLE_OK;
 }
 
@@ -485,6 +483,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
     /* Check all sbytes were sent */
     if(sbytes<0) {
       failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
+      return CURLE_SEND_ERROR;
     }
     break;
 
@@ -497,7 +496,8 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
     if(state->retries > state->retry_max) {
       state->error = TFTP_ERR_TIMEOUT;
       state->state = TFTP_STATE_FIN;
-    } else {
+    }
+    else {
       /* Re-send the data packet */
       sbytes = sendto(state->sockfd, (void *)&state->spacket,
                       4+state->sbytes, SEND_4TH_ARG,
@@ -506,6 +506,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
       /* Check all sbytes were sent */
       if(sbytes<0) {
         failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
+        return CURLE_SEND_ERROR;
       }
     }
     break;
@@ -738,6 +739,8 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
                                      state->rbytes-4);
             if(code)
               return code;
+            Curl_pgrsSetDownloadCounter(data,
+                                        (curl_off_t) state->rbytes-4);
           }
           break;
         case TFTP_EVENT_ERROR:
index 10a3f87dcc01bd3b65baa64058ca2a4148ed9932..f8d0af87bb14e8a25476d4901c82f1e829aba52e 100644 (file)
@@ -1792,9 +1792,11 @@ Transfer(struct connectdata *conn)
   struct Curl_transfer_keeper *k = &data->reqdata.keep;
   bool done=FALSE;
 
-  if(!(conn->protocol & PROT_FILE)) {
-    /* Only do this if we are not transferring FILE:, since the file: treatment
-       is different*/
+  if(!(conn->protocol & (PROT_FILE|PROT_TFTP))) {
+    /* Only do this if we are not transferring FILE or TFTP, since those
+       transfers are treated differently. They do their entire transfers in
+       the DO function and just returns from this. That is ugly indeed.
+    */
     Curl_readwrite_init(conn);
     Curl_pre_readwrite(conn);
   }