Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ iocore/eventsystem/test_Event
proxy/config/records.config.default
proxy/config/storage.config.default
proxy/http2/test_Huffmancode
proxy/http2/test_Http2DependencyTree
proxy/http2/test_Http2PriorityQueue

plugins/header_rewrite/header_rewrite_test
plugins/experimental/esi/*_test
Expand Down
2 changes: 2 additions & 0 deletions mgmt/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,8 @@ static const RecordElement RecordsConfig[] =
//############
{RECT_CONFIG, "proxy.config.http2.enabled", RECD_INT, "0", RECU_RESTART_TM, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.stream_priority_enabled", RECD_INT, "0", RECU_RESTART_TM, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.max_concurrent_streams_in", RECD_INT, "100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http2.initial_window_size_in", RECD_INT, "1048576", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
Expand Down
5 changes: 5 additions & 0 deletions proxy/FetchSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ class FetchSM : public Continuation
is_internal_request = val;
}

VIO* get_read_vio()
{
return read_vio;
}

private:
int InvokePlugin(int event, void *data);
void InvokePluginExt(int error_event = 0);
Expand Down
12 changes: 9 additions & 3 deletions proxy/http2/HTTP2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,19 @@ http2_parse_headers_parameter(IOVec iov, Http2HeadersParameter &params)
}

bool
http2_parse_priority_parameter(IOVec iov, Http2Priority &params)
http2_parse_priority_parameter(IOVec iov, Http2Priority &priority)
{
byte_pointer ptr(iov.iov_base);
byte_addressable_value<uint32_t> dependency;

memcpy_and_advance(dependency.bytes, ptr);
memcpy_and_advance(params.weight, ptr);

params.stream_dependency = ntohl(dependency.value);
priority.exclusive_flag = dependency.bytes[0] & 0x80;

dependency.bytes[0] &= 0x7f; // Clear the highest bit for exclusive flag
priority.stream_dependency = ntohl(dependency.value);

memcpy_and_advance(priority.weight, ptr);

return true;
}
Expand Down Expand Up @@ -727,6 +731,7 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t *buf_start, const uint8_t
}

// Initialize this subsystem with librecords configs (for now)
bool Http2::stream_priority_enabled = 0;
uint32_t Http2::max_concurrent_streams = 100;
uint32_t Http2::initial_window_size = 1048576;
uint32_t Http2::max_frame_size = 16384;
Expand All @@ -740,6 +745,7 @@ uint32_t Http2::active_timeout_in = 0;
void
Http2::init()
{
REC_EstablishStaticConfigBool(stream_priority_enabled, "proxy.config.http2.stream_priority_enabled");
REC_EstablishStaticConfigInt32U(max_concurrent_streams, "proxy.config.http2.max_concurrent_streams_in");
REC_EstablishStaticConfigInt32U(initial_window_size, "proxy.config.http2.initial_window_size_in");
REC_EstablishStaticConfigInt32U(max_frame_size, "proxy.config.http2.max_frame_size");
Expand Down
13 changes: 11 additions & 2 deletions proxy/http2/HTTP2.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ const uint32_t HTTP2_MAX_FRAME_SIZE = 16384;
const uint32_t HTTP2_HEADER_TABLE_SIZE = 4096;
const uint32_t HTTP2_MAX_HEADER_LIST_SIZE = UINT_MAX;

// [RFC 7540] 5.3.5 Default Priorities
const uint32_t HTTP2_PRIORITY_DEFAULT_STREAM_DEPENDENCY = 0;
const uint8_t HTTP2_PRIORITY_DEFAULT_WEIGHT = 15;

// Statistics
enum {
HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT, // Current # of active HTTP2
Expand Down Expand Up @@ -247,10 +251,14 @@ struct Http2SettingsParameter {

// [RFC 7540] 6.3 PRIORITY Format
struct Http2Priority {
Http2Priority() : stream_dependency(0), weight(15) {}
Http2Priority()
: exclusive_flag(false), weight(HTTP2_PRIORITY_DEFAULT_WEIGHT), stream_dependency(HTTP2_PRIORITY_DEFAULT_STREAM_DEPENDENCY)
{
}

uint32_t stream_dependency;
bool exclusive_flag;
uint8_t weight;
uint32_t stream_dependency;
};

// [RFC 7540] 6.2 HEADERS Format
Expand Down Expand Up @@ -342,6 +350,7 @@ int64_t http2_write_header_fragment(HTTPHdr *, MIMEFieldIter &, uint8_t *, uint6
class Http2
{
public:
static bool stream_priority_enabled;
static uint32_t max_concurrent_streams;
static uint32_t initial_window_size;
static uint32_t max_frame_size;
Expand Down
Loading