Lines 1663-1714
Link Here
|
1663 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, |
1663 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, |
1664 |
"Error reading from remote server"); |
1664 |
"Error reading from remote server"); |
1665 |
} |
1665 |
} |
1666 |
if (rc == 550) { |
|
|
1667 |
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, |
1668 |
"proxy: FTP: RETR failed, trying LIST instead"); |
1669 |
|
1670 |
/* Directory Listings should always be fetched in ASCII mode */ |
1671 |
dirlisting = 1; |
1672 |
ftp_set_TYPE('A', r, origin, bb, NULL); |
1673 |
|
1674 |
rc = proxy_ftp_command(apr_pstrcat(p, "CWD ", |
1675 |
ftp_escape_globbingchars(p, path), CRLF, NULL), |
1676 |
r, origin, bb, &ftpmessage); |
1677 |
/* possible results: 250, 421, 500, 501, 502, 530, 550 */ |
1678 |
/* 250 Requested file action okay, completed. */ |
1679 |
/* 421 Service not available, closing control connection. */ |
1680 |
/* 500 Syntax error, command unrecognized. */ |
1681 |
/* 501 Syntax error in parameters or arguments. */ |
1682 |
/* 502 Command not implemented. */ |
1683 |
/* 530 Not logged in. */ |
1684 |
/* 550 Requested action not taken. */ |
1685 |
if (rc == -1 || rc == 421) { |
1686 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, |
1687 |
"Error reading from remote server"); |
1688 |
} |
1689 |
if (rc == 550) { |
1690 |
return ap_proxyerror(r, HTTP_NOT_FOUND, ftpmessage); |
1691 |
} |
1692 |
if (rc != 250) { |
1693 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, ftpmessage); |
1694 |
} |
1695 |
|
1696 |
/* Update current directory after CWD */ |
1697 |
cwd = ftp_get_PWD(r, origin, bb); |
1698 |
if (cwd != NULL) { |
1699 |
apr_table_set(r->notes, "Directory-PWD", cwd); |
1700 |
} |
1701 |
|
1702 |
/* See above for the "LIST" vs. "LIST -lag" discussion. */ |
1703 |
rc = proxy_ftp_command((cwd == NULL || strchr(cwd, '/') != NULL) |
1704 |
? "LIST -lag" CRLF : "LIST" CRLF, |
1705 |
r, origin, bb, &ftpmessage); |
1706 |
|
1707 |
/* rc is an intermediate response for the LIST command (125 transfer starting, 150 opening data connection) */ |
1708 |
if (rc == -1 || rc == 421) |
1709 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, |
1710 |
"Error reading from remote server"); |
1711 |
} |
1712 |
if (rc != 125 && rc != 150 && rc != 226 && rc != 250) { |
1666 |
if (rc != 125 && rc != 150 && rc != 226 && rc != 250) { |
1713 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, ftpmessage); |
1667 |
return ap_proxyerror(r, HTTP_BAD_GATEWAY, ftpmessage); |
1714 |
} |
1668 |
} |