[libsoup] session: update the host header in case of redirection
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] session: update the host header in case of redirection
- Date: Thu, 10 Dec 2020 10:03:07 +0000 (UTC)
commit f1fec6526aa7638086f1d472b6a1877de69d90b1
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu Dec 10 11:01:02 2020 +0100
session: update the host header in case of redirection
libsoup/soup-session.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index ae564a89..874a254e 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -870,6 +870,7 @@ soup_session_redirect_message (SoupSession *session,
{
SoupSessionPrivate *priv;
GUri *new_uri;
+ char *host;
SoupMessageQueueItem *item;
gboolean retval;
@@ -892,6 +893,18 @@ soup_session_redirect_message (SoupSession *session,
SOUP_ENCODING_NONE);
}
+ host = soup_uri_get_host_for_headers (new_uri);
+ if (soup_uri_uses_default_port (new_uri))
+ soup_message_headers_replace (soup_message_get_request_headers (msg), "Host", host);
+ else {
+ char *value;
+
+ value = g_strdup_printf ("%s:%d", host, g_uri_get_port (new_uri));
+ soup_message_headers_replace (soup_message_get_request_headers (msg), "Host", value);
+ g_free (value);
+ }
+ g_free (host);
+
soup_message_set_uri (msg, new_uri);
g_uri_unref (new_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]