comparison prometheus-client-c-libpromhttp/files/patch-promhttp_src_promhttp.c @ 11:b25a1823eec3

Move old libpromhttp into prometheus-client-c-libpromhttp/ directory. Also remove its .hgignore because there is a new common .hgignore now already.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 19 Mar 2025 08:50:48 +0100
parents files/patch-promhttp_src_promhttp.c@4746e1c5cb56
children
comparison
equal deleted inserted replaced
10:40cf179a620e 11:b25a1823eec3
1 --- promhttp/src/promhttp.c.orig 2020-12-08 07:38:13 UTC
2 +++ promhttp/src/promhttp.c
3 @@ -29,32 +29,32 @@ void promhttp_set_active_collector_registry(prom_colle
4 }
5 }
6
7 -int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
8 +enum MHD_Result promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
9 const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) {
10 if (strcmp(method, "GET") != 0) {
11 char *buf = "Invalid HTTP Method\n";
12 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
13 - int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
14 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
15 MHD_destroy_response(response);
16 return ret;
17 }
18 if (strcmp(url, "/") == 0) {
19 char *buf = "OK\n";
20 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
21 - int ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
22 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
23 MHD_destroy_response(response);
24 return ret;
25 }
26 if (strcmp(url, "/metrics") == 0) {
27 const char *buf = prom_collector_registry_bridge(PROM_ACTIVE_REGISTRY);
28 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_MUST_FREE);
29 - int ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
30 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
31 MHD_destroy_response(response);
32 return ret;
33 }
34 char *buf = "Bad Request\n";
35 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
36 - int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
37 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
38 MHD_destroy_response(response);
39 return ret;
40 }