[libsoup] metrics: set response start when headers are read in several chunks



commit 33b29b13bdadb1b4c2071e171d77b924fd7e452a
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Apr 30 12:56:10 2021 +0200

    metrics: set response start when headers are read in several chunks

 libsoup/soup-message-io.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 49654ee8..79b739cb 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -538,8 +538,11 @@ io_read (SoupMessage *msg, gboolean blocking,
                 is_first_read = io->read_header_buf->len == 0 &&
                         soup_message_get_status (msg) == SOUP_STATUS_NONE;
 
-               if (!soup_message_io_data_read_headers (io, blocking, cancellable, &extra_bytes, error))
-                       return FALSE;
+                succeeded = soup_message_io_data_read_headers (io, blocking, cancellable, &extra_bytes, 
error);
+                if (is_first_read && io->read_header_buf->len > 0)
+                        soup_message_set_metrics_timestamp (msg, SOUP_MESSAGE_METRICS_RESPONSE_START);
+                if (!succeeded)
+                        return FALSE;
 
                 if (client_io->metrics) {
                         /* Adjust the header and body bytes received, since we might
@@ -552,9 +555,6 @@ io_read (SoupMessage *msg, gboolean blocking,
                         }
                 }
 
-                if (is_first_read)
-                        soup_message_set_metrics_timestamp (msg, SOUP_MESSAGE_METRICS_RESPONSE_START);
-
                succeeded = parse_headers (msg,
                                           (char *)io->read_header_buf->data,
                                           io->read_header_buf->len,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]