[libsoup/websockets-fixes-2.66: 5/5] WebSockets: ensure a new connection is created for WebSocket requests
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/websockets-fixes-2.66: 5/5] WebSockets: ensure a new connection is created for WebSocket requests
- Date: Fri, 11 Dec 2020 15:58:22 +0000 (UTC)
commit 3ca7a7501007d9a0bd693e0f9b03cf5b2336a8f7
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jan 28 11:06:29 2020 +0100
WebSockets: ensure a new connection is created for WebSocket requests
The spec says a new connection must be established and some servers
reply with a 400 Bad Request when reusing an existing connection.
libsoup/soup-session.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 5ecae857..e6a4c918 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -4868,6 +4868,7 @@ soup_session_websocket_connect_async (SoupSession *session,
SoupSessionPrivate *priv = soup_session_get_instance_private (session);
SoupMessageQueueItem *item;
GTask *task;
+ SoupMessageFlags flags;
g_return_if_fail (SOUP_IS_SESSION (session));
g_return_if_fail (priv->use_thread_context);
@@ -4875,6 +4876,15 @@ soup_session_websocket_connect_async (SoupSession *session,
soup_websocket_client_prepare_handshake (msg, origin, protocols);
+ /* When the client is to _Establish a WebSocket Connection_ given a set
+ * of (/host/, /port/, /resource name/, and /secure/ flag), along with a
+ * list of /protocols/ and /extensions/ to be used, and an /origin/ in
+ * the case of web browsers, it MUST open a connection, send an opening
+ * handshake, and read the server's handshake in response.
+ */
+ flags = soup_message_get_flags (msg);
+ soup_message_set_flags (msg, flags | SOUP_MESSAGE_NEW_CONNECTION);
+
task = g_task_new (session, cancellable, callback, user_data);
item = soup_session_append_queue_item (session, msg, TRUE, FALSE,
websocket_connect_async_complete, task);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]