def get_http2_upgrade_header(self): # try h2c protocol hc = {} hc["Upgrade"] = "h2c" hc['Connection'] = 'Upgrade, HTTP2-Settings' http2_settings = SettingsFrame(0) http2_settings.settings[SettingsFrame.INITIAL_WINDOW_SIZE] = 65535 settings = base64.urlsafe_b64encode( http2_settings.serialize_body()).rstrip(b'=').decode("utf8") hc['HTTP2-Settings'] = settings return hc
def _add_upgrade_headers(self, headers): # Add HTTP Upgrade headers. headers[b'connection'] = b'Upgrade, HTTP2-Settings' headers[b'upgrade'] = H2C_PROTOCOL # Encode SETTINGS frame payload in Base64 and put into the HTTP-2 # Settings header. http2_settings = SettingsFrame(0) http2_settings.settings[SettingsFrame.INITIAL_WINDOW_SIZE] = 65535 encoded_settings = base64.urlsafe_b64encode( http2_settings.serialize_body()) headers[b'HTTP2-Settings'] = encoded_settings.rstrip(b'=')
def _add_upgrade_headers(self, headers): # Add HTTP Upgrade headers. headers[b'connection'] = b'Upgrade, HTTP2-Settings' headers[b'upgrade'] = H2C_PROTOCOL # Encode SETTINGS frame payload in Base64 and put into the HTTP-2 # Settings header. http2_settings = SettingsFrame(0) http2_settings.settings[SettingsFrame.INITIAL_WINDOW_SIZE] = 65535 encoded_settings = base64.urlsafe_b64encode( http2_settings.serialize_body() ) headers[b'HTTP2-Settings'] = encoded_settings.rstrip(b'=')