Compare commits

..

No commits in common. "a38602ac2cbea1d96f8f72e673ed0a1ac8a9a1ed" and "1ff1aabffff7f645fb18ebf7cc390925b9a97b09" have entirely different histories.

5 changed files with 4 additions and 25 deletions

View File

@ -3,7 +3,6 @@
[![Build Status](https://github.com/an-tao/drogon/workflows/Build%20Drogon/badge.svg?branch=master)](https://github.com/drogonframework/drogon/actions)
[![Join the chat at https://gitter.im/drogon-web/community](https://badges.gitter.im/drogon-web/community.svg)](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the telegram group at https://t.me/joinchat/_mMNGv0748ZkMDAx](https://img.shields.io/badge/Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/joinchat/_mMNGv0748ZkMDAx)
[![Join our Discord](https://dcbadge.vercel.app/api/server/3DvHY6Ewuj?style=flat)](https://discord.gg/3DvHY6Ewuj)
[![Docker image](https://img.shields.io/badge/Docker-image-blue.svg)](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
English | [简体中文](./README.zh-CN.md) | [繁體中文](./README.zh-TW.md)

View File

@ -3,7 +3,6 @@
[![Build Status](https://github.com/an-tao/drogon/workflows/Build%20Drogon/badge.svg?branch=master)](https://github.com/drogonframework/drogon/actions)
[![Join the chat at https://gitter.im/drogon-web/community](https://badges.gitter.im/drogon-web/community.svg)](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the telegram group at https://t.me/joinchat/_mMNGv0748ZkMDAx](https://img.shields.io/badge/Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/joinchat/_mMNGv0748ZkMDAx)
[![Join our Discord](https://dcbadge.vercel.app/api/server/3DvHY6Ewuj?style=flat)](https://discord.gg/3DvHY6Ewuj)
[![Docker image](https://img.shields.io/badge/Docker-image-blue.svg)](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
[English](./README.md) | 简体中文 | [繁體中文](./README.zh-TW.md)

View File

@ -3,7 +3,6 @@
[![Build Status](https://github.com/an-tao/drogon/workflows/Build%20Drogon/badge.svg?branch=master)](https://github.com/drogonframework/drogon/actions)
[![Join the chat at https://gitter.im/drogon-web/community](https://badges.gitter.im/drogon-web/community.svg)](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the telegram group at https://t.me/joinchat/_mMNGv0748ZkMDAx](https://img.shields.io/badge/Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/joinchat/_mMNGv0748ZkMDAx)
[![Join our Discord](https://dcbadge.vercel.app/api/server/3DvHY6Ewuj?style=flat)](https://discord.gg/3DvHY6Ewuj)
[![Docker image](https://img.shields.io/badge/Docker-image-blue.svg)](https://cloud.docker.com/u/drogonframework/repository/docker/drogonframework/drogon)
[English](./README.md) | [简体中文](./README.zh-CN.md) | 繁體中文

View File

@ -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,

View File

@ -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);