]> git.seodisparate.com - c_simple_http/commitdiff
Minor fixes/cleanup
authorStephen Seo <seo.disparate@gmail.com>
Mon, 9 Sep 2024 04:53:58 +0000 (13:53 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 9 Sep 2024 04:53:58 +0000 (13:53 +0900)
18 files changed:
src/arg_parse.c
src/arg_parse.h
src/big_endian.c
src/big_endian.h
src/config.c
src/config.h
src/globals.c
src/globals.h
src/http.c
src/http.h
src/http_template.c
src/http_template.h
src/main.c
src/signal_handling.c
src/signal_handling.h
src/tcp_socket.c
src/tcp_socket.h
src/test.c

index 437d9c56bfc09cf7f98cf846a7a458603e1e58f6..f981e8303ccabdb4bfe34b28329271da1963d112 100644 (file)
@@ -90,4 +90,4 @@ void c_simple_http_free_args(Args *args) {
   }
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index f9b2d17cb43e352c4cc10368cf3547b41bc8de05..6aef9907eec846836799f6553f963175fe4a1748 100644 (file)
@@ -39,4 +39,4 @@ void c_simple_http_free_args(Args *args);
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 637fc29bd1e205742c11985a6414ceeb0253a568..7056f75c9b0eae687f5cb1c1137aaedf4a42593c 100644 (file)
@@ -33,4 +33,4 @@ unsigned short u16_be_swap(unsigned short value) {
   }
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 09306194d6b8dfa1f9d0ca94f6877bc21387eec9..2cb3c3e93c2aaa224f0a389f2bcae49b7101c8ec 100644 (file)
@@ -23,4 +23,4 @@ unsigned short u16_be_swap(unsigned short value);
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index f733bde92469e7aead2c84bb14259e28cef34117..eb6578f8ea58169779dced2b87ce70e51c86ff28 100644 (file)
@@ -462,4 +462,4 @@ void c_simple_http_clean_up_parsed_config(C_SIMPLE_HTTP_ParsedConfig *config) {
   simple_archiver_hash_map_free(&config->paths);
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 5794761565687ee3dfedab677d2da7fc7edab460..a194d28ebd48fdb0b0d1335fb55663262a16af99 100644 (file)
@@ -69,4 +69,4 @@ void c_simple_http_clean_up_parsed_config(C_SIMPLE_HTTP_ParsedConfig *config);
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index a333d6f464ad7d34f2d34ba2b950341e9481c0e7..9262d01d2e6b9a641b52b58d21eebbe2b9a5fd67 100644 (file)
@@ -18,4 +18,4 @@
 
 int C_SIMPLE_HTTP_KEEP_RUNNING = 1;
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 0d34ed98e1ea08e0f09329706cdf0040712a3e64..209b32ee211831e42e3f6397d8d0a46299f59d65 100644 (file)
@@ -21,4 +21,4 @@ extern int C_SIMPLE_HTTP_KEEP_RUNNING;
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 8213ffe18abef4137a2954432d191b79eb202826..701d8fd0afc0419319c49b3a72175543e963a73c 100644 (file)
@@ -281,4 +281,4 @@ SDArchiverHashMap *c_simple_http_request_to_headers_map(
   return hash_map;
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index bee2cf64ed7fcba44b366e99953b2dffd9f04655..411ff6bdb07715590061ade9b5d14e71d71896bc 100644 (file)
@@ -65,4 +65,4 @@ SDArchiverHashMap *c_simple_http_request_to_headers_map(
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index ea242cd8d58680967f2a0c383dfb5a91108c58fe..99e86a1377c57f5a20365852139ae1920454bcc4 100644 (file)
@@ -346,4 +346,4 @@ char *c_simple_http_path_to_generated(
   }
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index e7a9da94821f5cdaa16cc2fe89362561e6c513c5..ae4586b549b48861a25b006710d21dc981dadf42 100644 (file)
@@ -33,4 +33,4 @@ char *c_simple_http_path_to_generated(
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index b79de095ee5877a6796baaf39110eb74a5fcd10b..c797c613c07e808bd257b2d9ad918d4d5548b8e3 100644 (file)
 #include "http.h"
 #include "helpers.h"
 
-typedef struct C_SIMPLE_HTTP_INTERNAL_Header_Check_Ctx {
-  SDArchiverHashMap *headers_map;
-} C_SIMPLE_HTTP_INTERNAL_Header_Check_Ctx;
-
 #define CHECK_ERROR_WRITE(write_expr) \
   if (write_expr < 0) { \
     close(connection_fd); \
@@ -52,14 +48,14 @@ typedef struct C_SIMPLE_HTTP_INTERNAL_Header_Check_Ctx {
   }
 
 int c_simple_http_headers_check_print(void *data, void *ud) {
-  C_SIMPLE_HTTP_INTERNAL_Header_Check_Ctx *ctx = ud;
+  SDArchiverHashMap *headers_map = ud;
   const char *header_c_str = data;
 
   __attribute__((cleanup(simple_archiver_helper_cleanup_c_string)))
   char *header_c_str_lowercase = c_simple_http_helper_to_lowercase(
     header_c_str, strlen(header_c_str) + 1);
   char *matching_line = simple_archiver_hash_map_get(
-    ctx->headers_map,
+    headers_map,
     header_c_str_lowercase,
     strlen(header_c_str) + 1);
   if (matching_line) {
@@ -169,15 +165,14 @@ int main(int argc, char **argv) {
       puts("");
 #endif
       {
-        C_SIMPLE_HTTP_INTERNAL_Header_Check_Ctx ctx;
-        ctx.headers_map = c_simple_http_request_to_headers_map(
+        SDArchiverHashMap *headers_map = c_simple_http_request_to_headers_map(
           (const char*)recv_buf,
           (size_t)read_ret);
         simple_archiver_list_get(
           args.list_of_headers_to_log,
           c_simple_http_headers_check_print,
-          &ctx);
-        simple_archiver_hash_map_free(&ctx.headers_map);
+          headers_map);
+        simple_archiver_hash_map_free(&headers_map);
       }
 
       size_t response_size = 0;
@@ -249,4 +244,4 @@ int main(int argc, char **argv) {
   return 0;
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index a76ed2d13f22a33ada737efc5690c54f47b3551f..dfe434097026c5bdf95b7d0c4f5e9c43a6d1a63b 100644 (file)
@@ -34,4 +34,4 @@ void C_SIMPLE_HTTP_handle_sigint(int signal) {
   }
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 543ea6b673b1b61ad5a4114e18b0b1563de617b8..3456ebf28a47e774bc8e572400180d4e7bf38b2d 100644 (file)
@@ -21,4 +21,4 @@ void C_SIMPLE_HTTP_handle_sigint(int signal);
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index d8f4474aba1ca021ff789228d42cfd5aa4e4c30c..21b77b5811bff3f3d1b469d7330f0462c5e9f3f1 100644 (file)
@@ -110,4 +110,4 @@ void cleanup_tcp_socket(int *tcp_socket) {
   }
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index 1b54880ddc67a8ed146fb734889bfeb1f070dee6..4a8680d8002515767b0990fb7e3011ded45356ce 100644 (file)
@@ -25,4 +25,4 @@ void cleanup_tcp_socket(int *tcp_socket);
 
 #endif
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2
index bff1ce0a6533562a0fee137693caf67c022bc063..0456c8fc796bb57af3edd138bbf7a4830d2d565c 100644 (file)
@@ -465,4 +465,4 @@ int main(void) {
   RETURN()
 }
 
-// vim: ts=2 sts=2 sw=2
+// vim: et ts=2 sts=2 sw=2