mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-18 16:43:57 +08:00
Actually fix #481
This commit is contained in:
parent
1ce3e3bd16
commit
8e9dafb9ad
@ -26,23 +26,24 @@
|
|||||||
|
|
||||||
namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing {
|
namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing {
|
||||||
|
|
||||||
BufferBody::BufferBody(const oatpp::String& buffer, const data::share::StringKeyLabel& contentType)
|
BufferBody::BufferBody(const oatpp::String &buffer, const data::share::StringKeyLabel &contentType)
|
||||||
: m_buffer(buffer)
|
: m_buffer(buffer)
|
||||||
, m_contentType(contentType)
|
, m_contentType(contentType)
|
||||||
, m_inlineData(m_buffer->getData(), m_buffer->getSize())
|
, m_inlineData(m_buffer->getData(), m_buffer->getSize())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::shared_ptr<BufferBody> BufferBody::createShared(const oatpp::String& buffer, const data::share::StringKeyLabel& contentType) {
|
std::shared_ptr<BufferBody> BufferBody::createShared(const oatpp::String &buffer,
|
||||||
|
const data::share::StringKeyLabel &contentType) {
|
||||||
return Shared_Http_Outgoing_BufferBody_Pool::allocateShared(buffer, contentType);
|
return Shared_Http_Outgoing_BufferBody_Pool::allocateShared(buffer, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action& action) {
|
v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action &action) {
|
||||||
|
|
||||||
(void) action;
|
(void) action;
|
||||||
|
|
||||||
v_buff_size desiredToRead = m_inlineData.bytesLeft;
|
v_buff_size desiredToRead = m_inlineData.bytesLeft;
|
||||||
|
|
||||||
if(desiredToRead > 0) {
|
if (desiredToRead > 0) {
|
||||||
|
|
||||||
if (desiredToRead > count) {
|
if (desiredToRead > count) {
|
||||||
desiredToRead = count;
|
desiredToRead = count;
|
||||||
@ -59,9 +60,9 @@ v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action& actio
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferBody::declareHeaders(Headers& headers) {
|
void BufferBody::declareHeaders(Headers &headers) {
|
||||||
if(m_contentType) {
|
if (m_contentType) {
|
||||||
headers.put(Header::CONTENT_TYPE, m_contentType);
|
headers.putIfNotExists(Header::CONTENT_TYPE, m_contentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user