src/server/proxy/httpclient.c

changeset 673
144bdc33fdb6
parent 672
226bfd584075
child 674
6a031133a498
--- a/src/server/proxy/httpclient.c	Sun Feb 15 11:16:50 2026 +0100
+++ b/src/server/proxy/httpclient.c	Sun Feb 15 12:24:38 2026 +0100
@@ -28,6 +28,8 @@
 
 #include "httpclient.h"
 
+#include "../util/socket.h"
+
 #include <cx/buffer.h>
 #include <cx/string.h>
 #include <stdlib.h>
@@ -160,14 +162,11 @@
         return 1;
     }
     
-    int flags;
-    if ((flags = fcntl(socketfd, F_GETFL, 0)) == -1) {
-        flags = 0;
-    }
-    if (fcntl(socketfd, F_SETFL, flags | O_NONBLOCK) != 0) {
+    if(util_socket_setnonblock(socketfd, 1)) {
         close(socketfd);
         return 1;
     }
+    
     client->socketfd = socketfd;
     
     client->writeev.cookie = client;
@@ -353,3 +352,17 @@
     
     return client->req_buffer_pos < client->req_buffer_len;
 }
+
+
+
+/* --------------------------------- Tests --------------------------------- */
+
+static CX_TEST(test_http_client_send_request) {
+    CX_TEST_DO {
+        
+    }
+}
+
+void http_client_add_tests(CxTestSuite *suite) {
+    cx_test_register(suite, test_http_client_send_request);
+}

mercurial