[libsoup/carlosgc/http2-after-redirect] http2: remove Host and Connection headers from request after a redirect from HTTP/1 to HTTP/2
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/carlosgc/http2-after-redirect] http2: remove Host and Connection headers from request after a redirect from HTTP/1 to HTTP/2
- Date: Tue, 7 Jun 2022 08:59:30 +0000 (UTC)
commit c4980db1e7a63d1eb885aac08c28c878446c654b
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jun 7 10:55:22 2022 +0200
http2: remove Host and Connection headers from request after a redirect from HTTP/1 to HTTP/2
Otherwise we get a protocol error since Host header is replaced by :authority pseudo-header field in
HTTP/2.
Fixes #278
libsoup/soup-message.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 984dfdd4..f8d2c3e4 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -3194,8 +3194,10 @@ soup_message_update_request_host_if_needed (SoupMessage *msg)
{
SoupMessagePrivate *priv = soup_message_get_instance_private (msg);
- if (priv->http_version == SOUP_HTTP_2_0)
+ if (priv->http_version == SOUP_HTTP_2_0) {
+ soup_message_headers_remove_common (priv->request_headers, SOUP_HEADER_HOST);
return;
+ }
if (soup_message_headers_get_one_common (priv->request_headers, SOUP_HEADER_HOST))
return;
@@ -3208,8 +3210,10 @@ soup_message_force_keep_alive_if_needed (SoupMessage *msg)
{
SoupMessagePrivate *priv = soup_message_get_instance_private (msg);
- if (priv->http_version == SOUP_HTTP_2_0)
+ if (priv->http_version == SOUP_HTTP_2_0) {
+ soup_message_headers_remove_common (priv->request_headers, SOUP_HEADER_CONNECTION);
return;
+ }
/* Force keep alive connections for HTTP 1.0. Performance will
* improve when issuing multiple requests to the same host in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]