mirror of
https://github.com/drogonframework/drogon.git
synced 2025-07-26 00:00:47 -04:00
Compare commits
No commits in common. "a38602ac2cbea1d96f8f72e673ed0a1ac8a9a1ed" and "1ff1aabffff7f645fb18ebf7cc390925b9a97b09" have entirely different histories.
a38602ac2c
...
1ff1aabfff
@ -3,7 +3,6 @@
|
||||
[](https://github.com/drogonframework/drogon/actions)
|
||||
[](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://t.me/joinchat/_mMNGv0748ZkMDAx)
|
||||
[](https://discord.gg/3DvHY6Ewuj)
|
||||
[](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
|
||||
|
||||
English | [简体中文](./README.zh-CN.md) | [繁體中文](./README.zh-TW.md)
|
||||
|
@ -3,7 +3,6 @@
|
||||
[](https://github.com/drogonframework/drogon/actions)
|
||||
[](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://t.me/joinchat/_mMNGv0748ZkMDAx)
|
||||
[](https://discord.gg/3DvHY6Ewuj)
|
||||
[](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
|
||||
|
||||
[English](./README.md) | 简体中文 | [繁體中文](./README.zh-TW.md)
|
||||
|
@ -3,7 +3,6 @@
|
||||
[](https://github.com/drogonframework/drogon/actions)
|
||||
[](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://t.me/joinchat/_mMNGv0748ZkMDAx)
|
||||
[](https://discord.gg/3DvHY6Ewuj)
|
||||
[](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
|
||||
|
||||
[English](./README.md) | [简体中文](./README.zh-CN.md) | 繁體中文
|
||||
|
@ -1,10 +1,7 @@
|
||||
#include "Http2Transport.h"
|
||||
#include "HttpFileUploadRequest.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
|
||||
using namespace drogon;
|
||||
@ -28,13 +25,6 @@ static std::optional<size_t> stosz(const std::string &str)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr size_t enumMaxValue()
|
||||
{
|
||||
using Underlying = std::underlying_type_t<Enum>;
|
||||
return (std::numeric_limits<Underlying>::max)();
|
||||
}
|
||||
|
||||
enum class H2FrameType
|
||||
{
|
||||
Data = 0x0,
|
||||
@ -299,13 +289,13 @@ std::optional<DataFrame> DataFrame::parse(ByteStream &payload, uint8_t flags)
|
||||
}
|
||||
|
||||
assert(payload.remaining() >= frame.padLength);
|
||||
if (payload.remaining() > frame.padLength)
|
||||
size_t payloadSize = payload.remaining() - frame.padLength;
|
||||
if (payloadSize < 0)
|
||||
{
|
||||
LOG_TRACE << "data padding is larger than the payload size";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const size_t payloadSize = payload.remaining() - frame.padLength;
|
||||
if (payloadSize > 0x7fffffff)
|
||||
{
|
||||
LOG_ERROR << "data frame payload size too large";
|
||||
@ -846,7 +836,6 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
|
||||
}
|
||||
// TODO: Should be half-closed but trantor doesn't support it
|
||||
connPtr->shutdown();
|
||||
return;
|
||||
}
|
||||
else if (std::holds_alternative<PingFrame>(frame))
|
||||
{
|
||||
@ -1073,7 +1062,7 @@ bool Http2Transport::parseAndApplyHeaders(internal::H2Stream &stream,
|
||||
else if (key == ":status")
|
||||
{
|
||||
auto status = stosz(value);
|
||||
if (!status || *status > enumMaxValue<HttpStatusCode>())
|
||||
if (!status)
|
||||
{
|
||||
streamErrored(streamId, ReqResult::BadResponse);
|
||||
return false;
|
||||
@ -1105,7 +1094,7 @@ Http2Transport::Http2Transport(trantor::TcpConnectionPtr connPtr,
|
||||
if (!connPtr->connected())
|
||||
return;
|
||||
// Send HTTP/2 magic string
|
||||
batchedSendBuffer.write(h2_preamble);
|
||||
connPtr->send(h2_preamble.data(), h2_preamble.length());
|
||||
*bytesSent_ += h2_preamble.length();
|
||||
|
||||
// RFC 9113 3.4
|
||||
@ -1114,7 +1103,6 @@ Http2Transport::Http2Transport(trantor::TcpConnectionPtr connPtr,
|
||||
settingsFrame.settings.emplace_back((uint16_t)H2SettingsKey::EnablePush,
|
||||
0); // Disable push
|
||||
sendFrame(settingsFrame, 0);
|
||||
sendBufferedData();
|
||||
}
|
||||
|
||||
void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
|
||||
|
@ -5,7 +5,6 @@
|
||||
// TODO: Write our own HPACK implementation
|
||||
#include "hpack/HPacker.h"
|
||||
|
||||
#include <string_view>
|
||||
#include <variant>
|
||||
#include <climits>
|
||||
|
||||
@ -155,11 +154,6 @@ struct OByteStream
|
||||
buffer.append((char *)ptr, size);
|
||||
}
|
||||
|
||||
void write(const std::string_view &str)
|
||||
{
|
||||
buffer.append(str.data(), str.size());
|
||||
}
|
||||
|
||||
void overwriteU24BE(size_t offset, uint32_t value)
|
||||
{
|
||||
assert(value <= 0xffffff);
|
||||
|
Loading…
x
Reference in New Issue
Block a user