lib/protocol/hpack/context.rb in protocol-hpack-1.4.1 vs lib/protocol/hpack/context.rb in protocol-hpack-1.4.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
# Copyrigh, 2013, by Ilya Grigorik.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -38,75 +40,74 @@
# To decompress header blocks, a decoder only needs to maintain a
# dynamic table as a decoding context.
# No other state information is needed.
class Context
- # @private
- # Static table
- # - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#appendix-A
+ # Static header table.
+ # https://tools.ietf.org/html/rfc7541#appendix-A
STATIC_TABLE = [
- [':authority', ''],
- [':method', 'GET'],
- [':method', 'POST'],
- [':path', '/'],
- [':path', '/index.html'],
- [':scheme', 'http'],
- [':scheme', 'https'],
- [':status', '200'],
- [':status', '204'],
- [':status', '206'],
- [':status', '304'],
- [':status', '400'],
- [':status', '404'],
- [':status', '500'],
- ['accept-charset', ''],
- ['accept-encoding', 'gzip, deflate'],
- ['accept-language', ''],
- ['accept-ranges', ''],
- ['accept', ''],
- ['access-control-allow-origin', ''],
- ['age', ''],
- ['allow', ''],
- ['authorization', ''],
- ['cache-control', ''],
- ['content-disposition', ''],
- ['content-encoding', ''],
- ['content-language', ''],
- ['content-length', ''],
- ['content-location', ''],
- ['content-range', ''],
- ['content-type', ''],
- ['cookie', ''],
- ['date', ''],
- ['etag', ''],
- ['expect', ''],
- ['expires', ''],
- ['from', ''],
- ['host', ''],
- ['if-match', ''],
- ['if-modified-since', ''],
- ['if-none-match', ''],
- ['if-range', ''],
- ['if-unmodified-since', ''],
- ['last-modified', ''],
- ['link', ''],
- ['location', ''],
- ['max-forwards', ''],
- ['proxy-authenticate', ''],
- ['proxy-authorization', ''],
- ['range', ''],
- ['referer', ''],
- ['refresh', ''],
- ['retry-after', ''],
- ['server', ''],
- ['set-cookie', ''],
- ['strict-transport-security', ''],
- ['transfer-encoding', ''],
- ['user-agent', ''],
- ['vary', ''],
- ['via', ''],
- ['www-authenticate', ''],
- ].each {|pair| pair.each(&:freeze).freeze}.freeze
+ [":authority", ""],
+ [":method", "GET"],
+ [":method", "POST"],
+ [":path", "/"],
+ [":path", "/index.html"],
+ [":scheme", "http"],
+ [":scheme", "https"],
+ [":status", "200"],
+ [":status", "204"],
+ [":status", "206"],
+ [":status", "304"],
+ [":status", "400"],
+ [":status", "404"],
+ [":status", "500"],
+ ["accept-charset", ""],
+ ["accept-encoding", "gzip, deflate"],
+ ["accept-language", ""],
+ ["accept-ranges", ""],
+ ["accept", ""],
+ ["access-control-allow-origin", ""],
+ ["age", ""],
+ ["allow", ""],
+ ["authorization", ""],
+ ["cache-control", ""],
+ ["content-disposition", ""],
+ ["content-encoding", ""],
+ ["content-language", ""],
+ ["content-length", ""],
+ ["content-location", ""],
+ ["content-range", ""],
+ ["content-type", ""],
+ ["cookie", ""],
+ ["date", ""],
+ ["etag", ""],
+ ["expect", ""],
+ ["expires", ""],
+ ["from", ""],
+ ["host", ""],
+ ["if-match", ""],
+ ["if-modified-since", ""],
+ ["if-none-match", ""],
+ ["if-range", ""],
+ ["if-unmodified-since", ""],
+ ["last-modified", ""],
+ ["link", ""],
+ ["location", ""],
+ ["max-forwards", ""],
+ ["proxy-authenticate", ""],
+ ["proxy-authorization", ""],
+ ["range", ""],
+ ["referer", ""],
+ ["refresh", ""],
+ ["retry-after", ""],
+ ["server", ""],
+ ["set-cookie", ""],
+ ["strict-transport-security", ""],
+ ["transfer-encoding", ""],
+ ["user-agent", ""],
+ ["vary", ""],
+ ["via", ""],
+ ["www-authenticate", ""],
+ ].each(&:freeze).freeze
# Initializes compression context with appropriate client/server defaults and maximum size of the dynamic table.
#
# @param table [Array] Table of header key-value pairs.
# @option huffman [Symbol] One of `:always`, `:never`, `:shorter`. Controls use of compression.