[pop3] remove extra space in LIST command
authorOri Avtalion <ori@avtalion.name>
Mon, 20 Jun 2011 22:33:32 +0000 (01:33 +0300)
committerOri Avtalion <ori@avtalion.name>
Tue, 21 Jun 2011 15:12:05 +0000 (18:12 +0300)
Some servers, e.g. mail.bezeqint.net:110, consider it a syntax error

lib/pop3.c
tests/data/test810
tests/data/test811

index 0581c58..dc5a1c2 100644 (file)
@@ -481,11 +481,14 @@ static CURLcode pop3_list(struct connectdata *conn)
   CURLcode result = CURLE_OK;
   struct pop3_conn *pop3c = &conn->proto.pop3c;
 
-  result = Curl_pp_sendf(&conn->proto.pop3c.pp, "LIST %s", pop3c->mailbox);
+  if(pop3c->mailbox[0] != '\0')
+    result = Curl_pp_sendf(&conn->proto.pop3c.pp, "LIST %s", pop3c->mailbox);
+  else
+    result = Curl_pp_sendf(&conn->proto.pop3c.pp, "LIST");
   if(result)
     return result;
 
-  if(strlen(pop3c->mailbox))
+  if(pop3c->mailbox[0] != '\0')
     state(conn, POP3_LIST_SINGLE);
   else
     state(conn, POP3_LIST);
index d4f7597..1c31042 100644 (file)
@@ -38,7 +38,7 @@ pop3://%HOSTIP:%POP3PORT/ -u user:secret
 <protocol>
 USER user\r
 PASS secret\r
-LIST \r
+LIST\r
 QUIT\r
 </protocol>
 </verify>
index 850e5e2..ca107ab 100644 (file)
@@ -36,7 +36,7 @@ pop3://%HOSTIP:%POP3PORT/ -u user:secret
 <protocol>
 USER user\r
 PASS secret\r
-LIST \r
+LIST\r
 QUIT\r
 </protocol>
 </verify>