ASF Bugzilla – Attachment 20750 Details for
Bug 43275
Remove avoidable network transactions in mod_proxy_ftp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to remove SIZE command.
apache.35280 (text/plain), 4.80 KB, created by
rahul
on 2007-08-31 04:03:07 UTC
(
hide
)
Description:
Patch to remove SIZE command.
Filename:
MIME Type:
Creator:
rahul
Created:
2007-08-31 04:03:07 UTC
Size:
4.80 KB
patch
obsolete
>Index: modules/proxy/mod_proxy_ftp.c >=================================================================== >--- modules/proxy/mod_proxy_ftp.c (revision 571413) >+++ modules/proxy/mod_proxy_ftp.c (working copy) >@@ -776,7 +776,6 @@ > const char *password = NULL; > int len, rc; > int one = 1; >- char *size = NULL; > char xfer_type = 'A'; /* after ftp login, the default is ASCII */ > int dirlisting = 0; > #if defined(USE_MDTM) && (defined(HAVE_TIMEGM) || defined(HAVE_GMTOFF)) >@@ -1459,62 +1458,27 @@ > dirlisting = 1; > } > else { >- /* (from FreeBSD ftpd): >- * SIZE is not in RFC959, but Postel has blessed it and >- * it will be in the updated RFC. >- * >- * Return size of file in a format suitable for >- * using with RESTART (we just count bytes). >- */ >- /* from draft-ietf-ftpext-mlst-14.txt: >- * This value will >- * change depending on the current STRUcture, MODE and TYPE of the data >- * connection, or a data connection which would be created were one >- * created now. Thus, the result of the SIZE command is dependent on >- * the currently established STRU, MODE and TYPE parameters. >- */ >- /* Therefore: switch to binary if the user did not specify ";type=a" */ >- ftp_set_TYPE(xfer_type, r, origin, bb, &ftpmessage); >- rc = proxy_ftp_command(apr_pstrcat(p, "SIZE ", >- ftp_escape_globbingchars(p, path), CRLF, NULL), >- r, origin, bb, &ftpmessage); >+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >+ "proxy: FTP: Testing the directory with CWD"); >+ rc = proxy_ftp_command(apr_pstrcat(p, "CWD ", >+ ftp_escape_globbingchars(p, path), CRLF, NULL), >+ r, origin, bb, &ftpmessage); >+ /* possible results: 250, 421, 500, 501, 502, 530, 550 */ >+ /* 250 Requested file action okay, completed. */ >+ /* 421 Service not available, closing control connection. */ >+ /* 500 Syntax error, command unrecognized. */ >+ /* 501 Syntax error in parameters or arguments. */ >+ /* 502 Command not implemented. */ >+ /* 530 Not logged in. */ >+ /* 550 Requested action not taken. */ > if (rc == -1 || rc == 421) { > return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, >- "Error reading from remote server"); >+ "Error reading from remote server"); > } >- else if (rc == 213) {/* Size command ok */ >- int j; >- for (j = 0; apr_isdigit(ftpmessage[j]); j++) >- ; >- ftpmessage[j] = '\0'; >- if (ftpmessage[0] != '\0') >- size = ftpmessage; /* already pstrdup'ed: no copy necessary */ >- } >- else if (rc == 550) { /* Not a regular file */ >+ if (rc == 250) { > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >- "proxy: FTP: SIZE shows this is a directory"); >+ "proxy: FTP: CWD successful."); > dirlisting = 1; >- rc = proxy_ftp_command(apr_pstrcat(p, "CWD ", >- ftp_escape_globbingchars(p, path), CRLF, NULL), >- r, origin, bb, &ftpmessage); >- /* possible results: 250, 421, 500, 501, 502, 530, 550 */ >- /* 250 Requested file action okay, completed. */ >- /* 421 Service not available, closing control connection. */ >- /* 500 Syntax error, command unrecognized. */ >- /* 501 Syntax error in parameters or arguments. */ >- /* 502 Command not implemented. */ >- /* 530 Not logged in. */ >- /* 550 Requested action not taken. */ >- if (rc == -1 || rc == 421) { >- return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, >- "Error reading from remote server"); >- } >- if (rc == 550) { >- return ftp_proxyerror(r, backend, HTTP_NOT_FOUND, ftpmessage); >- } >- if (rc != 250) { >- return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, ftpmessage); >- } > path = ""; > len = 0; > } >@@ -1692,12 +1656,6 @@ > else { > ap_set_content_type(r, ap_default_type(r)); > } >- if (xfer_type != 'A' && size != NULL) { >- /* We "trust" the ftp server to really serve (size) bytes... */ >- apr_table_setn(r->headers_out, "Content-Length", size); >- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >- "proxy: FTP: Content-Length set to %s", size); >- } > } > apr_table_setn(r->headers_out, "Content-Type", r->content_type); > ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43275
: 20750