errors: new alias CURLE_WEIRD_SERVER_REPLY (8)

Since we're using CURLE_FTP_WEIRD_SERVER_REPLY in imap, pop3 and smtp as
more of a generic "failed to parse" introduce an alias without FTP in
the name.

Closes https://github.com/curl/curl/pull/975
This commit is contained in:
Jay Satiro 2016-08-22 15:37:03 -04:00
parent add8ee7d57
commit af2d679e14
15 changed files with 26 additions and 21 deletions

View File

@ -2254,7 +2254,7 @@ Couldn't resolve host. The given remote host was not resolved.
.IP 7
Failed to connect to host.
.IP 8
FTP weird server reply. The server sent data curl couldn't parse.
Weird server reply. The server sent data curl couldn't parse.
.IP 9
FTP access denied. The server denied login or denied access to the particular
resource or directory you wanted to reach. Most often you tried to change to a

View File

@ -60,9 +60,8 @@ Couldn't resolve host. The given remote host was not resolved.
.IP "CURLE_COULDNT_CONNECT (7)"
Failed to connect() to host or proxy.
.IP "CURLE_FTP_WEIRD_SERVER_REPLY (8)"
After connecting to a FTP server, libcurl expects to get a certain reply
back. This error code implies that it got a strange or bad reply. The given
remote server is probably not an OK FTP server.
The server sent data libcurl couldn't parse. This error code is used for more
than just FTP and is aliased as \fICURLE_WEIRD_SERVER_REPLY\fP since 7.51.0.
.IP "CURLE_REMOTE_ACCESS_DENIED (9)"
We were denied access to the resource given in the URL. For FTP, this occurs
while trying to change to the remote directory.

View File

@ -140,6 +140,7 @@ CURLE_UPLOAD_FAILED 7.16.3
CURLE_URL_MALFORMAT 7.1
CURLE_URL_MALFORMAT_USER 7.1 7.17.0
CURLE_USE_SSL_FAILED 7.17.0
CURLE_WEIRD_SERVER_REPLY 7.51.0
CURLE_WRITE_ERROR 7.1
CURLFILETYPE_DEVICE_BLOCK 7.21.0
CURLFILETYPE_DEVICE_CHAR 7.21.0

View File

@ -435,7 +435,7 @@ typedef enum {
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
CURLE_WEIRD_SERVER_REPLY, /* 8 */
CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
due to lack of access - when login fails
this is not returned. */
@ -566,6 +566,7 @@ typedef enum {
/* compatibility with older names */
#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
#define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY
/* The following were added in 7.21.5, April 2011 */
#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION

View File

@ -475,7 +475,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
if(ftpcode/100 > 3)
return CURLE_FTP_ACCEPT_FAILED;
return CURLE_FTP_WEIRD_SERVER_REPLY;
return CURLE_WEIRD_SERVER_REPLY;
}
break;
@ -1835,7 +1835,7 @@ static CURLcode ftp_epsv_disable(struct connectdata *conn)
if(conn->bits.ipv6) {
/* We can't disable EPSV when doing IPv6, so this is instead a fail */
failf(conn->data, "Failed EPSV attempt, exiting\n");
return CURLE_FTP_WEIRD_SERVER_REPLY;
return CURLE_WEIRD_SERVER_REPLY;
}
infof(conn->data, "Failed EPSV attempt. Disabling EPSV\n");
@ -2742,7 +2742,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
else if(ftpcode != 220) {
failf(data, "Got a %03d ftp-server response when 220 was expected",
ftpcode);
return CURLE_FTP_WEIRD_SERVER_REPLY;
return CURLE_WEIRD_SERVER_REPLY;
}
/* We have received a 220 response fine, now we proceed. */

View File

@ -846,7 +846,7 @@ static CURLcode imap_state_servergreet_resp(struct connectdata *conn,
if(imapcode != 'O') {
failf(data, "Got unexpected imap-server response");
result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */
result = CURLE_WEIRD_SERVER_REPLY;
}
else
result = imap_perform_capability(conn);
@ -1179,7 +1179,7 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
else {
/* We don't know how to parse this line */
failf(pp->conn->data, "Failed to parse FETCH response.");
result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */
result = CURLE_WEIRD_SERVER_REPLY;
}
/* End of DO phase */
@ -1198,7 +1198,7 @@ static CURLcode imap_state_fetch_final_resp(struct connectdata *conn,
(void)instate; /* No use for this yet */
if(imapcode != 'O')
result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: Fix error code */
result = CURLE_WEIRD_SERVER_REPLY;
else
/* End of DONE phase */
state(conn, IMAP_STOP);
@ -1275,7 +1275,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
/* Was there an error parsing the response line? */
if(imapcode == -1)
return CURLE_FTP_WEIRD_SERVER_REPLY;
return CURLE_WEIRD_SERVER_REPLY;
if(!imapcode)
break;

View File

@ -663,7 +663,7 @@ static CURLcode pop3_state_servergreet_resp(struct connectdata *conn,
if(pop3code != '+') {
failf(data, "Got unexpected pop3-server response");
result = CURLE_FTP_WEIRD_SERVER_REPLY;
result = CURLE_WEIRD_SERVER_REPLY;
}
else {
/* Does the server support APOP authentication? */

View File

@ -674,7 +674,7 @@ static CURLcode smtp_state_servergreet_resp(struct connectdata *conn,
if(smtpcode/100 != 2) {
failf(data, "Got unexpected smtp-server response: %d", smtpcode);
result = CURLE_FTP_WEIRD_SERVER_REPLY;
result = CURLE_WEIRD_SERVER_REPLY;
}
else
result = smtp_perform_ehlo(conn);

View File

@ -79,8 +79,8 @@ curl_easy_strerror(CURLcode error)
case CURLE_COULDNT_CONNECT:
return "Couldn't connect to server";
case CURLE_FTP_WEIRD_SERVER_REPLY:
return "FTP: weird server reply";
case CURLE_WEIRD_SERVER_REPLY:
return "Weird server reply";
case CURLE_REMOTE_ACCESS_DENIED:
return "Access denied to remote resource";

View File

@ -369,6 +369,8 @@
d c 6
d CURLE_COULDNT_CONNECT...
d c 7
d CURLE_WEIRD_SERVER_REPLY...
d c 8
d CURLE_FTP_WEIRD_SERVER_REPLY...
d c 8
d CURLE_REMOTE_ACCESS_DENIED...

View File

@ -57,7 +57,8 @@
#define CURL_COULDNT_RESOLVE_PROXY 251756594
#define CURL_COULDNT_RESOLVE_HOST 251756602
#define CURL_COULDNT_CONNECT 251756610
#define CURL_FTP_WEIRD_SERVER_REPLY 251756618
#define CURL_WEIRD_SERVER_REPLY 251756618
#define CURL_FTP_WEIRD_SERVER_REPLY CURL_WEIRD_SERVER_REPLY
#define CURL_FTP_ACCESS_DENIED 251756626
#define CURL_OBSOLETE10 251756634
#define CURL_FTP_WEIRD_PASS_REPLY 251756642

View File

@ -30,7 +30,7 @@ OBSOLETE4 <obsolete error code>
COULDNT_RESOLVE_PROXY <could not resolve proxy>
COULDNT_RESOLVE_HOST <could not resolve host>
COULDNT_CONNECT <could not connect>
FTP_WEIRD_SERVER_REPLY <FTP weird server reply>
WEIRD_SERVER_REPLY <weird server reply>
FTP_ACCESS_DENIED <FTP access denied>
OBSOLETE10 <obsolete error code>
FTP_WEIRD_PASS_REPLY <FTP weird PASS reply>

View File

@ -34,6 +34,7 @@
,"COULDNT_RESOLVE_PROXY" EQUALS %X0F018032 PREFIX "CURL" TAG ""
,"COULDNT_RESOLVE_HOST" EQUALS %X0F01803A PREFIX "CURL" TAG ""
,"COULDNT_CONNECT" EQUALS %X0F018042 PREFIX "CURL" TAG ""
,"WEIRD_SERVER_REPLY" EQUALS %X0F01804A PREFIX "CURL" TAG ""
,"FTP_WEIRD_SERVER_REPLY" EQUALS %X0F01804A PREFIX "CURL" TAG ""
,"FTP_ACCESS_DENIED" EQUALS %X0F018052 PREFIX "CURL" TAG ""
,"OBSOLETE10" EQUALS %X0F01805A PREFIX "CURL" TAG ""

View File

@ -59,7 +59,7 @@ static const long vms_cond[] =
CURL_COULDNT_RESOLVE_PROXY,
CURL_COULDNT_RESOLVE_HOST,
CURL_COULDNT_CONNECT,
CURL_FTP_WEIRD_SERVER_REPLY,
CURL_WEIRD_SERVER_REPLY,
CURL_FTP_ACCESS_DENIED,
CURL_OBSOLETE10,
CURL_FTP_WEIRD_PASS_REPLY,

View File

@ -19,7 +19,7 @@ In the broken scenario curl would use HTTP to talk to our FTP server. We handle
that by replying with something that both protocols can understand. Our FTP
server allows a custom welcome message, so we use that feature to make an HTTP
reply that contains an FTP reply (think polyglot). In the case of FTP we expect
curl will return CURLE_FTP_WEIRD_SERVER_REPLY so we test for that return code.
curl will return CURLE_WEIRD_SERVER_REPLY so we test for that return code.
-->
<servercmd>
REPLY welcome HTTP/1.1 200 OK\r\nContent-Length: 21\r\n\r\n500 Weird FTP Reply
@ -46,7 +46,7 @@ Set the default protocol to ftp for a schemeless URL
#
# Verify data after the test has been "shot"
<verify>
# CURLE_FTP_WEIRD_SERVER_REPLY is error code 8
# CURLE_WEIRD_SERVER_REPLY is error code 8
<errorcode>
8
</errorcode>