I try to write an application which first sends a
PROPFIND http request to a server requiring authentication. With libsoup 2.4 this was very simple by just connecting to the
authenticate signal, e.g. the following code (plus the signal handler connected to the
SoupSession) did the full job under the hood:
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 transmits the request, receives a 401, fires the signal, and sends the same request again, including the authentication. Works perfectly.
One of the changes in libsoup 3 includes the replacement of setting the request body by calling
soup_message_set_request_body_from_bytes() which in the docs states 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 (of course connected to the
SoupMessage), but the
SoupLogger output shows that the authenticated request is transmitted with the proper authentication and
Content-Length, but without the body.
Is there any further documentation or example code which clarifies this use case? I use Libsoup 3.2.2 on Debian Bookworm.