mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 11:47:56 +08:00
Update the submodule trantor
This commit is contained in:
parent
6d16877e7b
commit
c06affed2a
@ -74,7 +74,7 @@ class HttpViewData
|
||||
const char *format, ...)
|
||||
{
|
||||
std::string strBuffer;
|
||||
strBuffer.resize(1024);
|
||||
strBuffer.resize(128);
|
||||
va_list ap, backup_ap;
|
||||
va_start(ap, format);
|
||||
va_copy(backup_ap, ap);
|
||||
|
@ -219,8 +219,8 @@ void HttpRequestImpl::appendToBuffer(MsgBuffer *output) const
|
||||
if (!content.empty() || !_content.empty())
|
||||
{
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof buf, "Content-Length: %lu\r\n", static_cast<long unsigned int>(content.length() + _content.length()));
|
||||
output->append(buf);
|
||||
auto len = snprintf(buf, sizeof(buf), "Content-Length: %lu\r\n", static_cast<long unsigned int>(content.length() + _content.length()));
|
||||
output->append(buf, len);
|
||||
if (_contentTypeString.empty())
|
||||
{
|
||||
auto &type = webContentTypeToString(_contentType);
|
||||
|
@ -291,16 +291,16 @@ const char *HttpResponseImpl::statusCodeToString(int code)
|
||||
}
|
||||
void HttpResponseImpl::makeHeaderString(const std::shared_ptr<std::string> &headerStringPtr) const
|
||||
{
|
||||
char buf[64];
|
||||
char buf[128];
|
||||
assert(headerStringPtr);
|
||||
snprintf(buf, sizeof buf, "HTTP/1.1 %d ", _statusCode);
|
||||
headerStringPtr->append(buf);
|
||||
auto len = snprintf(buf, sizeof buf, "HTTP/1.1 %d ", _statusCode);
|
||||
headerStringPtr->append(buf, len);
|
||||
if (_statusMessage)
|
||||
headerStringPtr->append(_statusMessage);
|
||||
headerStringPtr->append("\r\n");
|
||||
if (_sendfileName.empty())
|
||||
{
|
||||
snprintf(buf, sizeof buf, "Content-Length: %lu\r\n", static_cast<long unsigned int>(_bodyPtr->size()));
|
||||
len = snprintf(buf, sizeof buf, "Content-Length: %lu\r\n", static_cast<long unsigned int>(_bodyPtr->size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -310,10 +310,10 @@ void HttpResponseImpl::makeHeaderString(const std::shared_ptr<std::string> &head
|
||||
LOG_SYSERR << _sendfileName << " stat error";
|
||||
return;
|
||||
}
|
||||
snprintf(buf, sizeof buf, "Content-Length: %llu\r\n", static_cast<long long unsigned int>(filestat.st_size));
|
||||
len = snprintf(buf, sizeof buf, "Content-Length: %llu\r\n", static_cast<long long unsigned int>(filestat.st_size));
|
||||
}
|
||||
|
||||
headerStringPtr->append(buf);
|
||||
headerStringPtr->append(buf, len);
|
||||
if (_headers.find("Connection") == _headers.end())
|
||||
{
|
||||
if (_closeConnection)
|
||||
@ -359,8 +359,7 @@ std::shared_ptr<std::string> HttpResponseImpl::renderToString() const
|
||||
return _httpString;
|
||||
}
|
||||
}
|
||||
auto httpString = std::make_shared<std::string>();
|
||||
httpString->reserve(256);
|
||||
auto httpString = std::make_shared<std::string>(256, '\0');
|
||||
if (!_fullHeaderString)
|
||||
{
|
||||
makeHeaderString(httpString);
|
||||
|
2
trantor
2
trantor
@ -1 +1 @@
|
||||
Subproject commit 35163a32c428d34d5783840d46972ecc42f8268e
|
||||
Subproject commit 52d757bbc85ac7f6c4118b9b675813e92cb8e8e0
|
Loading…
Reference in New Issue
Block a user