ZHTTP_SERVER(3)
π ZHTTP_SERVER(3) π
okay bestie, welcome to the CZMQ Manual, page for zhttp_server β pull up a chair, grab a boba, we're doing this π«Ά
β¨ NAME β¨
zhttp_server β Class for no title found
ngl the title being literally "no title found" is so real of it π anyway
πΈ SYNOPSIS πΈ
// This is a draft class, and may change without notice. It is disabled in
// stable builds by default. If you use this in applications, please ask
// for it to be pushed to stable state. Use --enable-drafts to enable.
#ifdef CZMQ_BUILD_DRAFT_API
// *** Draft method, for development use, may change without warning ***
// Create a new http server
CZMQ_EXPORT zhttp_server_t *
zhttp_server_new (zhttp_server_options_t *options);
// *** Draft method, for development use, may change without warning ***
// Destroy an http server
CZMQ_EXPORT void
zhttp_server_destroy (zhttp_server_t **self_p);
// *** Draft method, for development use, may change without warning ***
// Return the port the server is listening on.
CZMQ_EXPORT int
zhttp_server_port (zhttp_server_t *self);
// *** Draft method, for development use, may change without warning ***
// Self test of this class.
CZMQ_EXPORT void
zhttp_server_test (bool verbose);
#endif // CZMQ_BUILD_DRAFT_API
Please add '@interface' section in './../src/zhttp_server.c'.
β οΈ heads up babes: this whole class is a draft. it's disabled in stable builds by default, and it can change without notice. if you wanna use it for real, go ask nicely for it to be pushed to stable. turn it on with --enable-drafts. π
π¦ DESCRIPTION π¦
zhttp_server -
Please add @discuss section in ./../src/zhttp_server.c.
bestie the docs are literally empty, the maintainers left us on read π but that's okay, the example below carries fr fr
π EXAMPLE π
From zhttp_server_test method.
int port = 40000 + (randof (10000));
zhttp_server_options_t *options = zhttp_server_options_new ();
zhttp_server_options_set_port (options, port);
zhttp_server_t *server = zhttp_server_new (options);
assert (server);
zsock_t *worker = zsock_new_dealer (zhttp_server_options_backend_address (options));
zhttp_request_t *request = zhttp_request_new ();
void *connection = zhttp_request_recv (request, worker);
assert (connection);
assert (streq (zhttp_request_method (request), "POST"));
assert (streq (zhttp_request_url (request), "/"));
assert (streq (zhttp_request_content (request), "Hello!"));
zhttp_response_t *response = zhttp_response_new ();
zhttp_response_set_content_const (response, "Welcome!");
zhttp_response_set_status_code (response, 200);
rc = zhttp_response_send (response, worker, &connection);
assert (rc == 0);
zhttp_request_destroy (&request);
zhttp_response_destroy (&response);
zsock_destroy (&worker);
zhttp_server_destroy (&server);
zhttp_server_options_destroy (&options);
like look at her go β spin up a server, catch a "POST" to "/" with "Hello!" in it, yeet back a 200 with "Welcome!", then clean up every single thing you made. immaculate resource management, no notes, periodt. β¨
π AUTHORS π
The czmq manual was written by the authors in the AUTHORS file.
π RESOURCES π
Main web site:
Report bugs to the email zeromq-dev@lists.zeromq.org[1]
π COPYRIGHT π
Copyright (c) the Contributors as noted in the AUTHORS file. This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. LICENSE included with the czmq distribution.
π NOTES π
- zeromq-dev@lists.zeromq.org mailto:zeromq-dev@lists.zeromq.org
and that's the whole page bestie, you ate that π«Ά this little gem comes to you from CZMQ 4.2.1, dated 01/16/2026 β go forth and build ur servers, mwah ππΈπ
π¦ where this page comes from
- fedora 44: czmq-devel 4.2.1-24.fc44 Β· MPL-2.0
- fedora 44: czmq-devel 4.2.1-24.fc44 Β· MPL-2.0
- ubuntu resolute: libczmq-dev 4.2.1-3build1 Β· MPL-2.0
- ubuntu stonking: libczmq-dev 4.2.1-3build1 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms