zhttp_client(3)

zhttp_client(3)

CZMQ Manual - CZMQ/1.4.1

Name

zhttp_client - Class for provides a simple http client

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 client
CZMQ_EXPORT zhttp_client_t *
    zhttp_client_new (bool verbose);

//  *** Draft method, for development use, may change without warning ***
//  Destroy an http client
CZMQ_EXPORT void
    zhttp_client_destroy (zhttp_client_t **self_p);

//  *** Draft method, for development use, may change without warning ***
//  Self test of this class.
CZMQ_EXPORT void
    zhttp_client_test (bool verbose);

#endif // CZMQ_BUILD_DRAFT_API
Please add '@interface' section in './../src/zhttp_client.c'.

Description

zhttp_client - provides a simple http client

Please add @discuss section in ./../src/zhttp_client.c.

Example

From zhttp_client_test method

zhttp_client_t *self = zhttp_client_new (verbose);
assert (self);

zhttp_request_t* request = zhttp_request_new ();
zhttp_request_set_url (request, url);
zhttp_request_set_method (request, "GET");
int rc = zhttp_request_send (request, self, /*timeout*/ 10000, /* user args*/ NULL, NULL);
assert (rc == 0);

void *user_arg;
void *user_arg2;
zhttp_response_t* response = zhttp_response_new ();
rc = zhttp_response_recv (response, self, &user_arg, &user_arg2);
assert (rc == 0);
assert (streq (zhttp_response_content (response), "Hello World!"));

zhttp_client_destroy (&self);
zhttp_request_destroy (&request); zhttp_response_destroy (&response);

Authors

The CZMQ manual was written by Pieter Hintjens<moc.xitami|hp#moc.xitami|hp>.

Resources

Main web site: http://czmq.zeromq.org/

Report bugs to the ØMQ development mailing list: <gro.qmorez.stsil|ved-qmorez#gro.qmorez.stsil|ved-qmorez>

Copyright

Copyright (c) 1991-2010 iMatix Corporation and contributors. License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>. This is free software: you are free to change it and redistribute it. There is NO WARRANTY, to the extent permitted by law. For details see the files COPYING and COPYING.LESSER included with the CZMQ distribution.