'\" t .\" Title: zhttp_request .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 03/03/2019 .\" Manual: CZMQ Manual .\" Source: CZMQ 4.2.0 .\" Language: English .\" .TH "ZHTTP_REQUEST" "3" "03/03/2019" "CZMQ 4\&.2\&.0" "CZMQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" zhttp_request \- Class for zhttp server request\&. .SH "SYNOPSIS" .sp .nf // 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 request\&. CZMQ_EXPORT zhttp_request_t * zhttp_request_new (void); // *** Draft method, for development use, may change without warning *** // Destroy an http request\&. CZMQ_EXPORT void zhttp_request_destroy (zhttp_request_t **self_p); // *** Draft method, for development use, may change without warning *** // Receive a new request from zhttp_server\&. // Return the underlying connection if successful, to be used when calling zhttp_response_send\&. CZMQ_EXPORT void * zhttp_request_recv (zhttp_request_t *self, zsock_t *sock); // *** Draft method, for development use, may change without warning *** // Send a request to zhttp_client\&. // Url and the request path will be concatenated\&. // This behavior is useful for url rewrite and reverse proxy\&. // // Send also allow two user provided arguments which will be returned with the response\&. // The reason for two, is to be able to pass around the server connection when forwarding requests or both a callback function and an arg\&. CZMQ_EXPORT int zhttp_request_send (zhttp_request_t *self, zhttp_client_t *client, int timeout, void *arg, void *arg2); // *** Draft method, for development use, may change without warning *** // Get the request method CZMQ_EXPORT const char * zhttp_request_method (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Set the request method CZMQ_EXPORT void zhttp_request_set_method (zhttp_request_t *self, const char *method); // *** Draft method, for development use, may change without warning *** // Get the request url\&. // When receiving a request from http server this is only the path part of the url\&. CZMQ_EXPORT const char * zhttp_request_url (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Set the request url // When sending a request to http client this should be full url\&. CZMQ_EXPORT void zhttp_request_set_url (zhttp_request_t *self, const char *url); // *** Draft method, for development use, may change without warning *** // Get the request content type CZMQ_EXPORT const char * zhttp_request_content_type (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Set the request content type CZMQ_EXPORT void zhttp_request_set_content_type (zhttp_request_t *self, const char *content_type); // *** Draft method, for development use, may change without warning *** // Get the content length of the request CZMQ_EXPORT size_t zhttp_request_content_length (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Get the headers of the request CZMQ_EXPORT zhash_t * zhttp_request_headers (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Get the content of the request\&. CZMQ_EXPORT const char * zhttp_request_content (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Get the content of the request\&. // Caller owns return value and must destroy it when done\&. CZMQ_EXPORT char * zhttp_request_get_content (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Set the content of the request\&. // Content must by dynamically allocated string\&. // Takes ownership of the content\&. CZMQ_EXPORT void zhttp_request_set_content (zhttp_request_t *self, char **content); // *** Draft method, for development use, may change without warning *** // Set the content of the request\&.\&. // The content is assumed to be constant\-memory and will therefore not be copied or deallocated in any way\&. CZMQ_EXPORT void zhttp_request_set_content_const (zhttp_request_t *self, const char *content); // *** Draft method, for development use, may change without warning *** // Set the content to NULL CZMQ_EXPORT void zhttp_request_reset_content (zhttp_request_t *self); // *** Draft method, for development use, may change without warning *** // Match the path of the request\&. // Support wildcards with \*(Aq%s\*(Aq symbol inside the match string\&. // Matching wildcards until the next \*(Aq/\*(Aq, \*(Aq?\*(Aq or \*(Aq\e0\*(Aq\&. // On successful match the variadic arguments will be filled with the matching strings\&. // On successful match the method is modifying the url field and break it into substrings\&. // If you need to use the url, do it before matching or take a copy\&. // // User must not free the variadic arguments as they are part of the url\&. // // To use the percent symbol, just double it, e\&.g "%%something"\&. // // Example: // if (zhttp_request_match (request, "POST", "/send/%s/%s", &name, &id)) CZMQ_EXPORT bool zhttp_request_match (zhttp_request_t *self, const char *method, const char *path, \&.\&.\&.); // *** Draft method, for development use, may change without warning *** // Self test of this class\&. CZMQ_EXPORT void zhttp_request_test (bool verbose); #endif // CZMQ_BUILD_DRAFT_API Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhttp_request\&.c\*(Aq\&. .fi .SH "DESCRIPTION" .sp zhttp_request \- zhttp server request\&. Class can be reused\&. .sp Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zhttp_request\&.c\fR\&. .SH "EXAMPLE" .PP \fBFrom zhttp_request_test method\fR. .sp .if n \{\ .RS 4 .\} .nf Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zhttp_request\&.c\*(Aq\&. .fi .if n \{\ .RE .\} .sp .SH "AUTHORS" .sp The czmq manual was written by the authors in the AUTHORS file\&. .SH "RESOURCES" .sp Main web site: \m[blue]\fB\%\fR\m[] .sp Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> .SH "COPYRIGHT" .sp 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\&. .SH "NOTES" .IP " 1." 4 zeromq-dev@lists.zeromq.org .RS 4 \%mailto:zeromq-dev@lists.zeromq.org .RE