Commit f23729b6 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos
Browse files

io-http2: use GOnce to initialize the invalid headers hash set

parent c3d13283
Pipeline #284669 failed with stages
in 4 minutes and 59 seconds
......@@ -774,13 +774,17 @@ request_header_is_valid (const char *name)
{
static GHashTable *invalid_request_headers = NULL;
if (!invalid_request_headers) {
invalid_request_headers = g_hash_table_new (soup_str_case_hash, soup_str_case_equal);
g_hash_table_add (invalid_request_headers, "Connection");
g_hash_table_add (invalid_request_headers, "Keep-Alive");
g_hash_table_add (invalid_request_headers, "Proxy-Connection");
g_hash_table_add (invalid_request_headers, "Transfer-Encoding");
g_hash_table_add (invalid_request_headers, "Upgrade");
if (g_once_init_enter (&invalid_request_headers)) {
GHashTable *headers;
headers= g_hash_table_new (soup_str_case_hash, soup_str_case_equal);
g_hash_table_add (headers, "Connection");
g_hash_table_add (headers, "Keep-Alive");
g_hash_table_add (headers, "Proxy-Connection");
g_hash_table_add (headers, "Transfer-Encoding");
g_hash_table_add (headers, "Upgrade");
g_once_init_leave (&invalid_request_headers, headers);
}
return !g_hash_table_contains (invalid_request_headers, name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment