Commit ac9d9258 authored by Yang Tse's avatar Yang Tse
Browse files

Fix an issue, affecting FTP transfers, introduced with the transfer.c patch committed May 4.

Additionally some identation fixes.
parent f32dc6b8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@

                                  Changelog

Yang Tse (7 May 2009)
- Fixed an issue affecting FTP transfers, introduced with the transfer.c
  patch committed May 4.

Daniel Stenberg (7 May 2009)
- Man page *roff problems fixed thanks to input from Colin Watson. Problems
  reported in the Debian package.
+57 −59
Original line number Diff line number Diff line
@@ -130,15 +130,15 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
  struct SessionHandle *data = conn->data;
  size_t buffersize = (size_t)bytes;
  int nread;
  int sending_http_headers = FALSE;
  bool sending_http_headers = FALSE;

  if(data->req.upload_chunky) {
    /* if chunked Transfer-Encoding */
    buffersize -= (8 + 2 + 2);   /* 32bit hex + CRLF + CRLF */
    data->req.upload_fromhere += (8 + 2); /* 32bit hex + CRLF */
  }
  if((data->state.proto.http)
  && (data->state.proto.http->sending == HTTPSEND_REQUEST)) {
  if((conn->protocol&PROT_HTTP) &&
     (data->state.proto.http->sending == HTTPSEND_REQUEST)) {
    /* We're sending the HTTP request headers, not the data.
       Remember that so we don't re-translate them into garbage. */
    sending_http_headers = TRUE;
@@ -242,18 +242,16 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
    }

    nread+=strlen(endofline_native); /* for the added end of line */
  }
#ifdef CURL_DOES_CONVERSIONS
  } else {
    if((data->set.prefer_ascii) && (!sending_http_headers)) {
  else if((data->set.prefer_ascii) && (!sending_http_headers)) {
    CURLcode res;
    res = Curl_convert_to_network(data, data->req.upload_fromhere, nread);
    /* Curl_convert_to_network calls failf if unsuccessful */
      if(res != CURLE_OK) {
    if(res != CURLE_OK)
      return(res);
  }
    }
#endif /* CURL_DOES_CONVERSIONS */
  }

  *nreadp = nread;

@@ -1460,7 +1458,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
  ssize_t bytes_written;
  CURLcode result;
  ssize_t nread; /* number of bytes read */
  int sending_http_headers = FALSE;
  bool sending_http_headers = FALSE;

  if((k->bytecount == 0) && (k->writebytecount == 0))
    Curl_pgrsTime(data, TIMER_STARTTRANSFER);
@@ -1496,15 +1494,15 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
          break;
        }

        if(data->state.proto.http) {
          if(data->state.proto.http->sending == HTTPSEND_REQUEST) {
        if(conn->protocol&PROT_HTTP) {
          if(data->state.proto.http->sending == HTTPSEND_REQUEST)
            /* We're sending the HTTP request headers, not the data.
               Remember that so we don't change the line endings. */
            sending_http_headers = TRUE;
          } else {
          else
            sending_http_headers = FALSE;
        }
        }

        result = Curl_fillreadbuffer(conn, BUFSIZE, &fillcount);
        if(result)
          return result;
@@ -1534,13 +1532,13 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
      data->req.upload_present = nread;

      /* convert LF to CRLF if so asked */
      if((!sending_http_headers) &&
#ifdef CURL_DO_LINEEND_CONV
        /* always convert if we're FTPing in ASCII mode */
        if(((data->set.crlf) || (data->set.prefer_ascii))
         ((data->set.crlf) || (data->set.prefer_ascii))) {
#else
        if((data->set.crlf)
#endif /* CURL_DO_LINEEND_CONV */
        && (!sending_http_headers)) {
         (data->set.crlf)) {
#endif
        if(data->state.scratch == NULL)
          data->state.scratch = malloc(2*BUFSIZE);
        if(data->state.scratch == NULL) {