After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703200 - SoupLogger doesn't print available headers if the message is cancelled before the body is received
SoupLogger doesn't print available headers if the message is cancelled before...
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
2.43.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2013-06-27 15:49 UTC by Andres Gomez
Modified: 2013-07-15 11:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Modified get example showing that the logger doesn't print the headers of the response message if cancelling soon (4.85 KB, text/x-csrc)
2013-06-27 15:49 UTC, Andres Gomez
  Details
[soup-logger] Upon response, print headers ASAP (3.95 KB, patch)
2013-06-27 16:11 UTC, Andres Gomez
none Details | Review
[soup-logger] On response, always print headers (4.15 KB, patch)
2013-07-03 10:36 UTC, Andres Gomez
accepted-commit_now Details | Review

Description Andres Gomez 2013-06-27 15:49:48 UTC
Created attachment 247921 [details]
Modified get example showing that the logger doesn't print the headers of the response message if cancelling soon

SoupLogger works so it would only print upon response when the "got-informational" or "got-body" signals have been received.

This makes that we lose interesting information from the received headers if such signals are not received when, for example, we cancel the message prematurely.

SoupLogger can make it better since it may have received the headers much sooner and it would be interesting for the developer to have them ASAP.
Comment 1 Andres Gomez 2013-06-27 16:09:59 UTC
Forgot to provide instructions to run the "get" example with the modifications:

With:

$ ./examples/get -d -o http://www.igalia.com/ 2> /dev/null

We will see the debug information coming from the logger thanks to the "-d" flag.

Thanks to the "-o" flag, we will send the "body" data to "stderr" rather than "stoud" so it won't disturb us (we can also replace /dev/null with a file thanks to this).

With current implementation, as I've added a cancel message request, we won't see the information from the response to be printed by the logger.
Comment 2 Andres Gomez 2013-06-27 16:11:11 UTC
Created attachment 247923 [details] [review]
[soup-logger] Upon response, print headers ASAP

SoupLogger won't print any information upon
response until the "got-body" or
"got-informational" signals are received. If the
response message has been cancelled or requeued
first, we miss the headers information, even when
we would have been already able to print it.

Now, upon response, we print information with
SOUP_LOGGER_LOG_MINIMAL or SOUP_LOGGER_LOG_HEADERS
as soon as we receive the "got-headers" signal and
will print the information with
SOUP_LOGGER_LOG_BODY as soon as we receive the
"got-body" or "got-informational" signals.
Comment 3 Dan Winship 2013-06-29 16:50:24 UTC
The reason it does it this way is because otherwise, when there are multiple requests running in parallel, you can't tell which bodies go with which headers.

So one possibility would be to connect to ::finished on the message, and if you see a message finish before you printed the full response, then belatedly log it at that point.
Comment 4 Andres Gomez 2013-07-03 10:35:08 UTC
(In reply to comment #3)
> The reason it does it this way is because otherwise, when there are multiple
> requests running in parallel, you can't tell which bodies go with which
> headers.

Right!

> So one possibility would be to connect to ::finished on the message, and if you
> see a message finish before you printed the full response, then belatedly log
> it at that point.

Yep, I think that could work.
Comment 5 Andres Gomez 2013-07-03 10:36:35 UTC
Created attachment 248300 [details] [review]
[soup-logger] On response, always print headers

SoupLogger won't print any information upon
response until the "got-body" or
"got-informational" signals are received. If the
response message has been cancelled or requeued
first, we miss the headers information, even when
we would have been already able to print it.

Now, upon response, if the logging has not yet
happened when the "finished" signal is triggered,
we do perform the logging then.
Comment 6 Dan Winship 2013-07-13 15:48:52 UTC
Comment on attachment 248300 [details] [review]
[soup-logger] On response, always print headers

looks good
Comment 7 Andres Gomez 2013-07-15 11:36:37 UTC
Thanks for the review.

Pushed to master.