annotate files/patch-promhttp_src_promhttp.c @ 9:4746e1c5cb56

Build of libpromhttp for version 0.1.3. It needs the separate prometheus-client-c-libpromhttp and libmicrohttpd packages.
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 18 Mar 2025 18:17:59 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
1 --- promhttp/src/promhttp.c.orig 2020-12-08 07:38:13 UTC
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2 +++ promhttp/src/promhttp.c
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3 @@ -29,32 +29,32 @@ void promhttp_set_active_collector_registry(prom_colle
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
4 }
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
5 }
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
6
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
7 -int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
8 +enum MHD_Result promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
9 const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) {
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
10 if (strcmp(method, "GET") != 0) {
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
11 char *buf = "Invalid HTTP Method\n";
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
12 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
13 - int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
14 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
15 MHD_destroy_response(response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
16 return ret;
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
17 }
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
18 if (strcmp(url, "/") == 0) {
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
19 char *buf = "OK\n";
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
20 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
21 - int ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
22 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23 MHD_destroy_response(response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
24 return ret;
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 }
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26 if (strcmp(url, "/metrics") == 0) {
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
27 const char *buf = prom_collector_registry_bridge(PROM_ACTIVE_REGISTRY);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_MUST_FREE);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
29 - int ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
30 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
31 MHD_destroy_response(response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32 return ret;
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
33 }
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
34 char *buf = "Bad Request\n";
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
35 struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_PERSISTENT);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
36 - int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
37 + enum MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
38 MHD_destroy_response(response);
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
39 return ret;
4746e1c5cb56 Build of libpromhttp for version 0.1.3.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
40 }