Got SMTP to work with some broken SMTP servers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12671 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -921,6 +921,9 @@ SMTPProtocol::ReceiveResponse(BString &out)
|
|||||||
int32 len = 0,r;
|
int32 len = 0,r;
|
||||||
char buf[SMTP_RESPONSE_SIZE];
|
char buf[SMTP_RESPONSE_SIZE];
|
||||||
bigtime_t timeout = 1000000*180; // timeout 180 secs
|
bigtime_t timeout = 1000000*180; // timeout 180 secs
|
||||||
|
bool gotCode = false;
|
||||||
|
int32 errCode;
|
||||||
|
BString searchStr = "";
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct fd_set fds;
|
struct fd_set fds;
|
||||||
@@ -953,10 +956,21 @@ SMTPProtocol::ReceiveResponse(BString &out)
|
|||||||
r = recv(_fd,buf, SMTP_RESPONSE_SIZE - 1,0);
|
r = recv(_fd,buf, SMTP_RESPONSE_SIZE - 1,0);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (!gotCode)
|
||||||
|
{
|
||||||
|
if (buf[3] == ' ' || buf[3] == '-')
|
||||||
|
{
|
||||||
|
errCode = atol(buf);
|
||||||
|
gotCode = true;
|
||||||
|
searchStr << errCode << ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
len += r;
|
len += r;
|
||||||
out.Append(buf, r);
|
out.Append(buf, r);
|
||||||
if (strstr(buf, CRLF))
|
|
||||||
|
if (strstr(buf, CRLF) && (out.FindFirst(searchStr) != B_ERROR))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user