[libsoup] http2: do not use SOUP_MESSAGE_NEW_CONNECTION flag to implement misdirected response
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] http2: do not use SOUP_MESSAGE_NEW_CONNECTION flag to implement misdirected response
- Date: Thu, 3 Jun 2021 09:35:30 +0000 (UTC)
commit 38cd38e60b38ac6cd2e82d64743a56d598f46a9e
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu Jun 3 11:32:06 2021 +0200
http2: do not use SOUP_MESSAGE_NEW_CONNECTION flag to implement misdirected response
It's a user flag, if the user sets that flag, we don't retry in
case of misdirected response. Or if the message is re-used we don't want
to force a new connection if the user didn't set the flag.
libsoup/soup-message-private.h | 5 +++++
libsoup/soup-message.c | 18 ++++++++++++++++++
libsoup/soup-session.c | 9 +++++----
3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/soup-message-private.h b/libsoup/soup-message-private.h
index b64f7a52..1d458011 100644
--- a/libsoup/soup-message-private.h
+++ b/libsoup/soup-message-private.h
@@ -148,4 +148,9 @@ void soup_message_set_force_http1 (SoupMessage *msg,
gboolean force_http1);
gboolean soup_message_get_force_http1 (SoupMessage *msg);
+
+void soup_message_set_is_misdirected_retry (SoupMessage *msg,
+ gboolean is_misdirected_retry);
+gboolean soup_message_is_misdirected_retry (SoupMessage *msg);
+
#endif /* __SOUP_MESSAGE_PRIVATE_H__ */
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index f17c1ec7..d95d1110 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -98,6 +98,7 @@ typedef struct {
gboolean is_top_level_navigation;
gboolean is_options_ping;
gboolean force_http1;
+ gboolean is_misdirected_retry;
guint last_connection_id;
GSocketAddress *remote_address;
@@ -2929,3 +2930,20 @@ soup_message_get_force_http1 (SoupMessage *msg)
return priv->force_http1;
}
+
+void
+soup_message_set_is_misdirected_retry (SoupMessage *msg,
+ gboolean is_misdirected_retry)
+{
+ SoupMessagePrivate *priv = soup_message_get_instance_private (msg);
+
+ priv->is_misdirected_retry = is_misdirected_retry;
+}
+
+gboolean
+soup_message_is_misdirected_retry (SoupMessage *msg)
+{
+ SoupMessagePrivate *priv = soup_message_get_instance_private (msg);
+
+ return priv->is_misdirected_retry;
+}
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 82c7b6e0..08aea5de 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1297,11 +1297,11 @@ misdirected_handler (SoupMessage *msg,
/* HTTP/2 messages may get the misdirected request status and MAY
* try a new connection */
- if (!soup_message_query_flags (msg, SOUP_MESSAGE_NEW_CONNECTION)) {
- soup_message_add_flags (msg, SOUP_MESSAGE_NEW_CONNECTION);
+ if (!soup_message_is_misdirected_retry (msg)) {
+ soup_message_set_is_misdirected_retry (msg, TRUE);
soup_session_requeue_item (session,
- item,
- &item->error);
+ item,
+ &item->error);
}
}
@@ -1915,6 +1915,7 @@ get_connection (SoupMessageQueueItem *item, gboolean *should_cleanup)
need_new_connection =
(soup_message_query_flags (item->msg, SOUP_MESSAGE_NEW_CONNECTION)) ||
+ (soup_message_is_misdirected_retry (item->msg)) ||
(!soup_message_query_flags (item->msg, SOUP_MESSAGE_IDEMPOTENT) &&
!SOUP_METHOD_IS_IDEMPOTENT (soup_message_get_method (item->msg)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]