[libsoup/nacho/fixes: 2/3] soup-server-io: lower variable scope




commit 18112af9f2bbd7b4d1d02e8e33e5b7eeb1a169a4
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Wed Jul 21 13:30:23 2021 +0200

    soup-server-io: lower variable scope

 libsoup/server/soup-server-io.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/server/soup-server-io.c b/libsoup/server/soup-server-io.c
index 68214c2d..5449c0f1 100644
--- a/libsoup/server/soup-server-io.c
+++ b/libsoup/server/soup-server-io.c
@@ -288,7 +288,6 @@ write_headers (SoupServerMessage  *msg,
        const char *reason_phrase;
        const char *method;
        SoupMessageHeaders *response_headers;
-       SoupMessageBody *response_body;
 
         if (soup_server_message_get_status (msg) == 0)
                 soup_server_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR, NULL);
@@ -315,9 +314,11 @@ write_headers (SoupServerMessage  *msg,
         else
                 *encoding = claimed_encoding;
 
-       response_body = soup_server_message_get_response_body (msg);
         if (claimed_encoding == SOUP_ENCODING_CONTENT_LENGTH &&
             !soup_message_headers_get_content_length (response_headers)) {
+                SoupMessageBody *response_body;
+
+                response_body = soup_server_message_get_response_body (msg);
                 soup_message_headers_set_content_length (response_headers,
                                                          response_body->length);
         }


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