migrate authentication from 2.4 -> 3 does not re-transmit SoupMessage payload
[I already asked this question in the discourse forum, but didn't get any answer, and the mailing list seems to be dead since a long time – please excuse me if this issue is not the proper approach either]
I try to port an application from libsoup 2.4 to 3.0 which first sends a PROPFIND
request to a server requiring authentication.
With libsoup 2.4 this was very simple by just connecting to the SoupSession::authenticate
signal, e.g. the following code (plus the signal handler connected to the SoupSession
) did the full job:
msg = soup_message_new("PROPFIND", url);
soup_message_set_request(msg, mime_type, SOUP_MEMORY_STATIC, buffer, strlen(buffer));
result = soup_session_send_message(session, msg);
Libsoup 2 transmits the request, receives a 401
, fires the signal, handler calls soup_auth_authenticate()
, and libsoup sends the same request again, including the authentication. Works perfectly.
Blindly using the same approach with libsoup 3, of course connecting the handler to SoupMessage::authenticate
, results in re-transmitting the request with the proper auth data and Content-Length
, but no payload is actually sent, and the request times out.
The Migrating from libsoup 2 section of the docs just states that the authenticate
signal has been moved and refers to the new convenience API soup_message_set_request_body_from_bytes()
as (obvious?) replacement for soup_message_set_request()
. The docs for it note that …the request body needs to be set again in case msg
is restarted (in case of redirection or authentication).
How is “…set again” supposed to be implemented? I tried to just call soup_message_set_request_body_from_bytes()
using the same GBytes
in the signal handler, but the payload is still not sent.
Can you please provide a documentation how existing code for this use case shall be migrated from libsoup 2.4 to 3, and maybe a general example how authentication shall be implemented for a request sending a payload.