This is an automated email from the ASF dual-hosted git repository.

ianmcook pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-experiments.git


The following commit(s) were added to refs/heads/main by this push:
     new 43bab35  c_glib: Disable keep-alive for stable result with Ruby server 
(#20)
43bab35 is described below

commit 43bab35ec9f17a45a4089e9daf4fc9d20a12fde4
Author: Sutou Kouhei <[email protected]>
AuthorDate: Wed Mar 13 20:07:34 2024 +0900

    c_glib: Disable keep-alive for stable result with Ruby server (#20)
---
 http/get_simple/c_glib/client/client.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/http/get_simple/c_glib/client/client.c 
b/http/get_simple/c_glib/client/client.c
index 7b8c1a5..e5a98a6 100644
--- a/http/get_simple/c_glib/client/client.c
+++ b/http/get_simple/c_glib/client/client.c
@@ -30,6 +30,15 @@ main(int argc, char **argv)
   SoupSession *session = soup_session_new();
   SoupMessage *message = soup_message_new(SOUP_METHOD_GET,
                                           "http://localhost:8008";);
+  /* Disable keep-alive explicitly. (libsoup uses keep-alive by
+   * default.)
+   *
+   * In general, keep-alive will improve performance when we send
+   * many GET requests to the same server. But in this case, we send
+   * only one GET request. So we don't need keep-alive here.
+   */
+  SoupMessageHeaders *headers = soup_message_get_request_headers(message);
+  soup_message_headers_append(headers, "connection", "close");
 
   GTimer *timer = g_timer_new();
 

Reply via email to