Bug 259305 - [SOUP] Does not reuse TCP connection for POST fetch requests
Summary: [SOUP] Does not reuse TCP connection for POST fetch requests
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: Other
Hardware: Unspecified Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-18 05:54 PDT by laurence.ejraee
Modified: 2023-07-18 07:56 PDT (History)
4 users (show)

See Also:


Attachments
Image showing TCP connection created again for another POST (27.14 KB, image/png)
2023-07-18 05:54 PDT, laurence.ejraee
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description laurence.ejraee 2023-07-18 05:54:24 PDT
Created attachment 467066 [details]
Image showing TCP connection created again for another POST

On any version of wpewebkit, carrying out multiple POST fetch request does not reuse the TCP connection and instead creates a new connection for each request.
This occurs on wpewebkit 2.22, 2.28, and epiphany browser running WebKitGTK 2.38.6

For example with:
fetch('https://reqres.in/api/articles', {  method: "POST", body: JSON.stringify({ title: 'Fetch POST Request Example' }) });

On Chrome two calls to the above code reuse the connection from the first call.
On wpewebkit it is not reused.
[See image]

It is my understanding that persistent connections should be used here because the request and response headers have connection: keep-alive. Persistent connections should keep the TCP connection so that other fetches to the url can reuse the connection.

Question: Should multiple POST fetch requests reuse their connection like in Chrome or create a new connection for each request as seen?

Thanks.
Comment 1 Patrick Griffis 2023-07-18 07:35:24 PDT
Can you confirm that this is built with libsoup2 or libsoup3 and what version of libsoup? Also does the website use HTTP/2 or HTTP/1.1 (you can enable the Protocol column in the inspector).

This issue is could be one of libsoup and not WPE.

Also maybe a real world example that you can find is helpful. Just testing it in the wild here (with libsoup 3 and HTTP/2) and the connection was shared.
Comment 2 laurence.ejraee 2023-07-18 07:44:10 PDT
This is built with libsoup2 version 2.62.3. Looking at the inspector the website is using HTTP/1.1 as request states: POST /stg/v1.0/create-authcode HTTP/1.1  and response states: HTTP/1.1 200 OK

I'll see if I can find real world example and update.

Thanks.
Comment 3 Patrick Griffis 2023-07-18 07:52:56 PDT
Ah I can confirm that libsoup does not share for POST requests:

https://gitlab.gnome.org/GNOME/libsoup/-/blob/d1509188ebd2219db1a147e9d77ffd5b4d161a2e/libsoup/soup-connection-manager.c#L399

I think this issue should be moved there.
Comment 4 laurence.ejraee 2023-07-18 07:56:23 PDT
Thanks for the very quick and valuable feedback, I'll move to libsoup.

Kind regards.