1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Save some cycle.

There is no need to copy, strchr, strcmp and modify a string which is only used for TRACE2 logging.

Note that the code that looks similar a few lines below can not be optimized the same way because it is also returned in 'pmessage'.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1838318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christophe Jaillet
2018-08-18 08:32:15 +00:00
parent 735db52a48
commit c66bd262c1

View File

@@ -813,17 +813,19 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_flush_create(c->bucket_alloc)); APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_flush_create(c->bucket_alloc));
ap_pass_brigade(ftp_ctrl->output_filters, bb); ap_pass_brigade(ftp_ctrl->output_filters, bb);
/* strip off the CRLF for logging */ if (APLOGrtrace2(r)) {
apr_cpystrn(message, cmd, sizeof(message)); /* strip off the CRLF for logging */
if ((crlf = strchr(message, '\r')) != NULL || apr_cpystrn(message, cmd, sizeof(message));
(crlf = strchr(message, '\n')) != NULL) if ((crlf = strchr(message, '\r')) != NULL ||
*crlf = '\0'; (crlf = strchr(message, '\n')) != NULL)
if (strncmp(message,"PASS ", 5) == 0) *crlf = '\0';
strcpy(&message[5], "****"); if (strncmp(message,"PASS ", 5) == 0)
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", message); strcpy(&message[5], "****");
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", message);
}
} }
rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof message); rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof(message));
if (rc == -1 || rc == 421) if (rc == -1 || rc == 421)
strcpy(message,"<unable to read result>"); strcpy(message,"<unable to read result>");
if ((crlf = strchr(message, '\r')) != NULL || if ((crlf = strchr(message, '\r')) != NULL ||