mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 13:47:10 +01:00
added ListMap
ListMap is a map that does not order elements; used in NameValueCollection to prevent reordering of message headers
This commit is contained in:
@@ -160,8 +160,8 @@ void HTMLFormTest::testWriteMultipart()
|
||||
"\r\n"
|
||||
"This is an attachment\r\n"
|
||||
"--MIME_boundary_0123456789\r\n"
|
||||
"Content-Disposition: form-data; name=\"attachment2\"; filename=\"att2.txt\"\r\n"
|
||||
"Content-ID: 1234abcd\r\n"
|
||||
"Content-Disposition: form-data; name=\"attachment2\"; filename=\"att2.txt\"\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"\r\n"
|
||||
"This is another attachment\r\n"
|
||||
|
||||
@@ -172,7 +172,8 @@ void HTTPCredentialsTest::testDigestCredentials()
|
||||
HTTPResponse response;
|
||||
response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
|
||||
creds.authenticate(request, response);
|
||||
assert (request.get("Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
|
||||
std::string auth = request.get("Authorization");
|
||||
assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
|
||||
}
|
||||
|
||||
|
||||
@@ -244,8 +245,9 @@ void HTTPCredentialsTest::testCredentialsDigest()
|
||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/digest/");
|
||||
HTTPResponse response;
|
||||
response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
|
||||
creds.authenticate(request, response);
|
||||
assert (request.get("Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
|
||||
creds.authenticate(request, response);
|
||||
std::string auth = request.get("Authorization");
|
||||
assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +258,7 @@ void HTTPCredentialsTest::testProxyCredentialsDigest()
|
||||
HTTPResponse response;
|
||||
response.set("Proxy-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\"");
|
||||
creds.proxyAuthenticate(request, response);
|
||||
assert (request.get("Proxy-Authorization") == "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\"");
|
||||
assert (request.get("Proxy-Authorization") == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\"");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void HTTPRequestTest::testWrite2()
|
||||
std::ostringstream ostr;
|
||||
request.write(ostr);
|
||||
std::string s = ostr.str();
|
||||
assert (s == "HEAD /index.html HTTP/1.1\r\nConnection: Keep-Alive\r\nHost: localhost\r\nUser-Agent: Poco\r\n\r\n");
|
||||
assert (s == "HEAD /index.html HTTP/1.1\r\nHost: localhost\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void HTTPRequestTest::testWrite3()
|
||||
std::ostringstream ostr;
|
||||
request.write(ostr);
|
||||
std::string s = ostr.str();
|
||||
assert (s == "POST /test.cgi HTTP/1.1\r\nConnection: Close\r\nContent-Length: 100\r\nContent-Type: text/plain\r\nHost: localhost:8000\r\nUser-Agent: Poco\r\n\r\n");
|
||||
assert (s == "POST /test.cgi HTTP/1.1\r\nHost: localhost:8000\r\nConnection: Close\r\nUser-Agent: Poco\r\nContent-Length: 100\r\nContent-Type: text/plain\r\n\r\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -136,13 +136,13 @@ void MailMessageTest::testWriteQP()
|
||||
message.write(str);
|
||||
std::string s = str.str();
|
||||
assert (s ==
|
||||
"CC: Jane Doe <jane.doe@no.where>\r\n"
|
||||
"Content-Transfer-Encoding: quoted-printable\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Subject: Test Message\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Transfer-Encoding: quoted-printable\r\n"
|
||||
"To: John Doe <john.doe@no.where>\r\n"
|
||||
"CC: Jane Doe <jane.doe@no.where>\r\n"
|
||||
"\r\n"
|
||||
"Hello, world!\r\n"
|
||||
"This is a test for the MailMessage class.\r\n"
|
||||
@@ -172,11 +172,11 @@ void MailMessageTest::testWrite8Bit()
|
||||
message.write(str);
|
||||
std::string s = str.str();
|
||||
assert (s ==
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Subject: Test Message\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"To: John Doe <john.doe@no.where>\r\n"
|
||||
"\r\n"
|
||||
"Hello, world!\r\n"
|
||||
@@ -204,11 +204,11 @@ void MailMessageTest::testWriteBase64()
|
||||
message.write(str);
|
||||
std::string s = str.str();
|
||||
assert (s ==
|
||||
"Content-Transfer-Encoding: base64\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Subject: Test Message\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Transfer-Encoding: base64\r\n"
|
||||
"To: John Doe <john.doe@no.where>\r\n"
|
||||
"\r\n"
|
||||
"SGVsbG8sIHdvcmxkIQ0KVGhpcyBpcyBhIHRlc3QgZm9yIHRoZSBNYWlsTWVzc2FnZSBjbGFz\r\n"
|
||||
@@ -244,15 +244,15 @@ void MailMessageTest::testWriteManyRecipients()
|
||||
message.write(str);
|
||||
std::string s = str.str();
|
||||
assert (s ==
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Subject: Test Message\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"To: John Doe <john.doe@no.where>, Jane Doe <jane.doe@no.where>, \r\n"
|
||||
"\tFrank Foo <walter.foo@no.where>, Bernie Bar <bernie.bar@no.where>, \r\n"
|
||||
"\tJoe Spammer <joe.spammer@no.where>\r\n"
|
||||
"\r\n"
|
||||
"\tFrank Foo <walter.foo@no.where>, Bernie Bar <bernie.bar@no.where>, \r\n"
|
||||
"\tJoe Spammer <joe.spammer@no.where>\r\n"
|
||||
"\r\n"
|
||||
"Hello, world!\r\n"
|
||||
"This is a test for the MailMessage class.\r\n"
|
||||
);
|
||||
@@ -279,32 +279,32 @@ void MailMessageTest::testWriteMultiPart()
|
||||
message.write(str);
|
||||
std::string s = str.str();
|
||||
std::string rawMsg(
|
||||
"Content-Type: multipart/mixed; boundary=$\r\n"
|
||||
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"Mime-Version: 1.0\r\n"
|
||||
"Content-Type: multipart/mixed; boundary=$\r\n"
|
||||
"Subject: Test Message\r\n"
|
||||
"From: poco@appinf.com\r\n"
|
||||
"To: John Doe <john.doe@no.where>\r\n"
|
||||
"Mime-Version: 1.0\r\n"
|
||||
"\r\n"
|
||||
"--$\r\n"
|
||||
"Content-Disposition: inline\r\n"
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Content-Transfer-Encoding: 8bit\r\n"
|
||||
"Content-Disposition: inline\r\n"
|
||||
"\r\n"
|
||||
"Hello World!\r\n"
|
||||
"\r\n"
|
||||
"--$\r\n"
|
||||
"Content-Disposition: attachment; filename=sample.dat\r\n"
|
||||
"Content-ID: abcd1234\r\n"
|
||||
"Content-Transfer-Encoding: base64\r\n"
|
||||
"Content-Type: application/octet-stream; name=sample\r\n"
|
||||
"Content-Transfer-Encoding: base64\r\n"
|
||||
"Content-Disposition: attachment; filename=sample.dat\r\n"
|
||||
"\r\n"
|
||||
"VGhpcyBpcyBzb21lIGJpbmFyeSBkYXRhLiBSZWFsbHku\r\n"
|
||||
"--$--\r\n"
|
||||
);
|
||||
std::string::size_type p1 = s.find('=') + 1;
|
||||
std::string::size_type p2 = s.find('\r');
|
||||
std::string boundary(s, p1, p2 - p1);
|
||||
std::string::size_type p2 = s.rfind("--");
|
||||
std::string::size_type p1 = s.rfind("--", p2 - 1);
|
||||
std::string boundary(s, p1 + 2, p2 - 2 - p1);
|
||||
std::string msg;
|
||||
for (std::string::const_iterator it = rawMsg.begin(); it != rawMsg.end(); ++it)
|
||||
{
|
||||
|
||||
@@ -136,16 +136,16 @@ void SMTPClientSessionTest::testSend()
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "DATA");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Type: text/plain");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "From: john.doe@no.where");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Subject: Test Message");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Hello");
|
||||
@@ -199,20 +199,20 @@ void SMTPClientSessionTest::testSendMultiRecipient()
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "DATA");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "CC: Jack Doe <jack.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Type: text/plain");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "From: john.doe@no.where");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Subject: Test Message");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "CC: Jack Doe <jack.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Hello");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "blah blah");
|
||||
@@ -269,20 +269,20 @@ void SMTPClientSessionTest::testMultiSeparateRecipient()
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "DATA");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "CC: Jack Doe <jack.doe@no.where>, Joe Doe <joe.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Type: text/plain");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd.substr(0, 4) == "Date");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "From: john.doe@no.where");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Subject: Test Message");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Content-Transfer-Encoding: quoted-printable");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "To: Jane Doe <jane.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "CC: Jack Doe <jack.doe@no.where>, Joe Doe <joe.doe@no.where>");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "Hello");
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "blah blah");
|
||||
|
||||
Reference in New Issue
Block a user