1ZHTTP_CLIENT(3)                   CZMQ Manual                  ZHTTP_CLIENT(3)
2
3
4

NAME

6       zhttp_client - Class for provides a simple http client
7

SYNOPSIS

9       //  This is a draft class, and may change without notice. It is disabled in
10       //  stable builds by default. If you use this in applications, please ask
11       //  for it to be pushed to stable state. Use --enable-drafts to enable.
12       #ifdef CZMQ_BUILD_DRAFT_API
13       //  *** Draft method, for development use, may change without warning ***
14       //  Create a new http client
15       CZMQ_EXPORT zhttp_client_t *
16           zhttp_client_new (bool verbose);
17
18       //  *** Draft method, for development use, may change without warning ***
19       //  Destroy an http client
20       CZMQ_EXPORT void
21           zhttp_client_destroy (zhttp_client_t **self_p);
22
23       //  *** Draft method, for development use, may change without warning ***
24       //  Self test of this class.
25       CZMQ_EXPORT void
26           zhttp_client_test (bool verbose);
27
28       #endif // CZMQ_BUILD_DRAFT_API
29       Please add '@interface' section in './../src/zhttp_client.c'.
30

DESCRIPTION

32       zhttp_client - provides a simple http client
33
34       Please add @discuss section in ./../src/zhttp_client.c.
35

EXAMPLE

37       From zhttp_client_test method.
38
39           zhttp_client_t *self = zhttp_client_new (verbose);
40           assert (self);
41
42           zhttp_request_t* request = zhttp_request_new ();
43           zhttp_request_set_url (request, url);
44           zhttp_request_set_method (request, "GET");
45           int rc = zhttp_request_send (request, self, /*timeout*/ 10000, /* user args*/ NULL, NULL);
46           assert (rc == 0);
47
48           void *user_arg;
49           void *user_arg2;
50           zhttp_response_t* response = zhttp_response_new ();
51           rc = zhttp_response_recv (response, self, &user_arg, &user_arg2);
52           assert (rc == 0);
53           assert (streq (zhttp_response_content (response), "Hello World!"));
54
55           zhttp_client_destroy (&self);
56           zhttp_request_destroy (&request);
57           zhttp_response_destroy (&response);
58
59

AUTHORS

61       The czmq manual was written by the authors in the AUTHORS file.
62

RESOURCES

64       Main web site:
65
66       Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>
67
69       Copyright (c) the Contributors as noted in the AUTHORS file. This file
70       is part of CZMQ, the high-level C binding for 0MQ:
71       http://czmq.zeromq.org. This Source Code Form is subject to the terms
72       of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
73       distributed with this file, You can obtain one at
74       http://mozilla.org/MPL/2.0/. LICENSE included with the czmq
75       distribution.
76

NOTES

78        1. zeromq-dev@lists.zeromq.org
79           mailto:zeromq-dev@lists.zeromq.org
80
81
82
83CZMQ 4.2.1                        01/19/2023                   ZHTTP_CLIENT(3)
Impressum