added better support for 'Expect: 100-continue' header and '100 Continue' responses

This commit is contained in:
Guenter Obiltschnig
2015-10-06 11:11:16 +02:00
parent 6bb1f4ad62
commit c66849f9ee
11 changed files with 175 additions and 41 deletions

View File

@@ -43,6 +43,7 @@ const std::string HTTPRequest::COOKIE = "Cookie";
const std::string HTTPRequest::AUTHORIZATION = "Authorization";
const std::string HTTPRequest::PROXY_AUTHORIZATION = "Proxy-Authorization";
const std::string HTTPRequest::UPGRADE = "Upgrade";
const std::string HTTPRequest::EXPECT = "Expect";
HTTPRequest::HTTPRequest():
@@ -259,4 +260,20 @@ void HTTPRequest::setCredentials(const std::string& header, const std::string& s
}
bool HTTPRequest::getExpectContinue() const
{
const std::string& expect = get(EXPECT, EMPTY);
return !expect.empty() && icompare(expect, "100-continue") == 0;
}
void HTTPRequest::setExpectContinue(bool expectContinue)
{
if (expectContinue)
set(EXPECT, "100-continue");
else
erase(EXPECT);
}
} } // namespace Poco::Net