Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multiline response support #746

Merged
merged 1 commit into from
Jul 28, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions source/vibe/mail/smtp.d
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,15 @@ private void expectStatus(InputStream conn, int expected_status, string in_respo
string ln = cast(string)conn.readLine();
auto sp = ln.indexOf(' ');
if( sp < 0 ) sp = ln.length;
auto status = to!int(ln[0 .. sp]);
enforce(status == expected_status, "Expected status "~to!string(expected_status)~" in response to "~in_response_to~", got "~to!string(status)~": "~ln[sp .. $]);
auto dsh = ln.indexOf('-');
if (dsh != -1 && dsh < sp)
{
expectStatus(conn, expected_status, in_response_to);
}
else {
auto status = to!int(ln[0 .. sp]);
enforce(status == expected_status, "Expected status "~to!string(expected_status)~" in response to "~in_response_to~", got "~to!string(status)~": "~ln[sp .. $]);
}
}

private int recvStatus(InputStream conn)
Expand Down