Permalink
Browse files

Based on a patch by Armel Asselin, the FTP code no longer re-issues t…

…he TYPE

command on subsequent requests on a re-used connection unless it has to.
  • Loading branch information...
1 parent 74a6921 commit cfdcae4bc75fba04b9864cae18e0bbe66b8655b9 @bagder bagder committed Aug 19, 2006
Showing with 139 additions and 99 deletions.
  1. +3 −0 CHANGES
  2. +1 −0 RELEASE-NOTES
  3. +17 −17 lib/content_encoding.c
  4. +3 −3 lib/content_encoding.h
  5. +4 −4 lib/file.c
  6. +70 −28 lib/ftp.c
  7. +1 −1 lib/http.c
  8. +5 −5 lib/http_chunks.c
  9. +10 −10 lib/ldap.c
  10. +3 −2 lib/sendf.c
  11. +1 −1 lib/sendf.h
  12. +3 −3 lib/telnet.c
  13. +2 −2 lib/tftp.c
  14. +7 −7 lib/transfer.c
  15. +6 −6 lib/url.c
  16. +3 −3 lib/urldata.h
  17. +0 −1 tests/data/test146
  18. +0 −1 tests/data/test149
  19. +0 −1 tests/data/test210
  20. +0 −1 tests/data/test211
  21. +0 −1 tests/data/test212
  22. +0 −1 tests/data/test215
  23. +0 −1 tests/data/test216
View
@@ -7,6 +7,9 @@
Changelog
Daniel (19 August 2006)
+- Based on a patch by Armel Asselin, the FTP code no longer re-issues the TYPE
+ command on subsequent requests on a re-used connection unless it has to.
+
- Armel Asselin fixed a crash in the FTP code when using SINGLECWD mode and
files in the root directory.
View
@@ -11,6 +11,7 @@ Curl and libcurl 7.15.6
This release includes the following changes:
+ o (FTP) libcurl avoids sending TYPE if the desired type was already set
o CURLOPT_PREQUOTE works even when CURLOPT_NOBODY is set true
This release includes the following bugfixes:
View
@@ -62,9 +62,9 @@ enum zlibState {
};
static CURLcode
-process_zlib_error(struct SessionHandle *data,
- z_stream *z)
+process_zlib_error(struct connectdata *conn, z_stream *z)
{
+ struct SessionHandle *data = conn->data;
if (z->msg)
failf (data, "Error while processing content unencoding: %s",
z->msg);
@@ -84,7 +84,7 @@ exit_zlib(z_stream *z, bool *zlib_init, CURLcode result)
}
static CURLcode
-inflate_stream(struct SessionHandle *data,
+inflate_stream(struct connectdata *conn,
struct Curl_transfer_keeper *k)
{
int allow_restart = 1;
@@ -113,7 +113,7 @@ inflate_stream(struct SessionHandle *data,
if (status == Z_OK || status == Z_STREAM_END) {
allow_restart = 0;
if(DSIZ - z->avail_out) {
- result = Curl_client_write(data, CLIENTWRITE_BODY, decomp,
+ result = Curl_client_write(conn, CLIENTWRITE_BODY, decomp,
DSIZ - z->avail_out);
/* if !CURLE_OK, clean up, return */
if (result) {
@@ -128,7 +128,7 @@ inflate_stream(struct SessionHandle *data,
if (inflateEnd(z) == Z_OK)
return exit_zlib(z, &k->zlib_init, result);
else
- return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
+ return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}
/* Done with these bytes, exit */
@@ -143,7 +143,7 @@ inflate_stream(struct SessionHandle *data,
inflateReset(z);
if (inflateInit2(z, -MAX_WBITS) != Z_OK) {
- return process_zlib_error(data, z);
+ return process_zlib_error(conn, z);
}
z->next_in = orig_in;
z->avail_in = nread;
@@ -152,14 +152,14 @@ inflate_stream(struct SessionHandle *data,
}
else { /* Error; exit loop, handle below */
free(decomp);
- return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
+ return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}
}
/* Will never get here */
}
CURLcode
-Curl_unencode_deflate_write(struct SessionHandle *data,
+Curl_unencode_deflate_write(struct connectdata *conn,
struct Curl_transfer_keeper *k,
ssize_t nread)
{
@@ -173,7 +173,7 @@ Curl_unencode_deflate_write(struct SessionHandle *data,
z->next_in = NULL;
z->avail_in = 0;
if (inflateInit(z) != Z_OK)
- return process_zlib_error(data, z);
+ return process_zlib_error(conn, z);
k->zlib_init = ZLIB_INIT;
}
@@ -182,7 +182,7 @@ Curl_unencode_deflate_write(struct SessionHandle *data,
z->avail_in = (uInt)nread;
/* Now uncompress the data */
- return inflate_stream(data, k);
+ return inflate_stream(conn, k);
}
#ifdef OLD_ZLIB_SUPPORT
@@ -272,7 +272,7 @@ static enum {
#endif
CURLcode
-Curl_unencode_gzip_write(struct SessionHandle *data,
+Curl_unencode_gzip_write(struct connectdata *conn,
struct Curl_transfer_keeper *k,
ssize_t nread)
{
@@ -289,14 +289,14 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
if (strcmp(zlibVersion(), "1.2.0.4") >= 0) {
/* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
if (inflateInit2(z, MAX_WBITS+32) != Z_OK) {
- return process_zlib_error(data, z);
+ return process_zlib_error(conn, z);
}
k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
} else {
/* we must parse the gzip header ourselves */
if (inflateInit2(z, -MAX_WBITS) != Z_OK) {
- return process_zlib_error(data, z);
+ return process_zlib_error(conn, z);
}
k->zlib_init = ZLIB_INIT; /* Initial call state */
}
@@ -307,7 +307,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
z->next_in = (Bytef *)k->str;
z->avail_in = (uInt)nread;
/* Now uncompress the data */
- return inflate_stream(data, k);
+ return inflate_stream(conn, k);
}
#ifndef OLD_ZLIB_SUPPORT
@@ -360,7 +360,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
case GZIP_BAD:
default:
- return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
+ return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}
}
@@ -398,7 +398,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
case GZIP_BAD:
default:
free(z->next_in);
- return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
+ return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}
}
@@ -418,7 +418,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
}
/* We've parsed the header, now uncompress the data */
- return inflate_stream(data, k);
+ return inflate_stream(conn, k);
#endif
}
#endif /* HAVE_LIBZ */
View
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -31,11 +31,11 @@
#define ALL_CONTENT_ENCODINGS "identity"
#endif
-CURLcode Curl_unencode_deflate_write(struct SessionHandle *data,
+CURLcode Curl_unencode_deflate_write(struct connectdata *conn,
struct Curl_transfer_keeper *k,
ssize_t nread);
CURLcode
-Curl_unencode_gzip_write(struct SessionHandle *data,
+Curl_unencode_gzip_write(struct connectdata *conn,
struct Curl_transfer_keeper *k,
ssize_t nread);
View
@@ -311,11 +311,11 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
CURLcode result;
snprintf(buf, sizeof(data->state.buffer),
"Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
- result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
+ result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
if(result)
return result;
- result = Curl_client_write(data, CLIENTWRITE_BOTH,
+ result = Curl_client_write(conn, CLIENTWRITE_BOTH,
(char *)"Accept-ranges: bytes\r\n", 0);
if(result)
return result;
@@ -339,7 +339,7 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
tm->tm_hour,
tm->tm_min,
tm->tm_sec);
- result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
+ result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
}
return result;
}
@@ -377,7 +377,7 @@ CURLcode Curl_file(struct connectdata *conn, bool *done)
bytecount += nread;
- res = Curl_client_write(data, CLIENTWRITE_BODY, buf, nread);
+ res = Curl_client_write(conn, CLIENTWRITE_BODY, buf, nread);
if(res)
return res;
Oops, something went wrong.

0 comments on commit cfdcae4

Please sign in to comment.