mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
Net: near complete merge to 1.4.2
This commit is contained in:
@@ -88,22 +88,26 @@ void HTTPMessage::setVersion(const std::string& version)
|
||||
}
|
||||
|
||||
|
||||
void HTTPMessage::setContentLength(int length)
|
||||
void HTTPMessage::setContentLength(std::streamsize length)
|
||||
{
|
||||
if (length != UNKNOWN_CONTENT_LENGTH)
|
||||
set(CONTENT_LENGTH, NumberFormatter::format(length));
|
||||
if (length != UNKNOWN_CONTENT_LENGTH)
|
||||
set(CONTENT_LENGTH, NumberFormatter::format(length));
|
||||
else
|
||||
erase(CONTENT_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
int HTTPMessage::getContentLength() const
|
||||
|
||||
std::streamsize HTTPMessage::getContentLength() const
|
||||
{
|
||||
const std::string& contentLength = get(CONTENT_LENGTH, EMPTY);
|
||||
if (!contentLength.empty())
|
||||
return NumberParser::parse(contentLength);
|
||||
else
|
||||
return UNKNOWN_CONTENT_LENGTH;
|
||||
const std::string& contentLength = get(CONTENT_LENGTH, EMPTY);
|
||||
if (!contentLength.empty())
|
||||
{
|
||||
if (sizeof(std::streamsize) == sizeof(Poco::Int64))
|
||||
return static_cast<std::streamsize>(NumberParser::parse64(contentLength));
|
||||
else
|
||||
return static_cast<std::streamsize>(NumberParser::parse(contentLength));
|
||||
}
|
||||
else return UNKNOWN_CONTENT_LENGTH;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +175,7 @@ bool HTTPMessage::getKeepAlive() const
|
||||
{
|
||||
const std::string& connection = get(CONNECTION, EMPTY);
|
||||
if (!connection.empty())
|
||||
return icompare(connection, CONNECTION_KEEP_ALIVE) == 0;
|
||||
return icompare(connection, CONNECTION_CLOSE) != 0;
|
||||
else
|
||||
return getVersion() == HTTP_1_1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user