⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 microhttpd.h

📁 一个 http 服务器的框架实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/*     This file is part of libmicrohttpd     (C) 2006, 2007 Christian Grothoff (and other contributing authors)     libmicrohttpd is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published     by the Free Software Foundation; either version 2, or (at your     option) any later version.     libmicrohttpd is distributed in the hope that it will be useful, but     WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     General Public License for more details.     You should have received a copy of the GNU General Public License     along with libmicrohttpd; see the file COPYING.  If not, write to the     Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA.*//** * @file microhttpd.h * @brief public interface to libmicrohttpd * @author Christian Grothoff * @author Chris GauthierDickey * * All symbols defined in this header start with MHD.  MHD is a * micro-httpd library.  As such, it does not have any API for logging * errors.  Also, it may not support all of the HTTP features directly, * where applicable, portions of HTTP may have to be handled by  * clients of the library (the library is supposed to handle * everything that it must handle, such as basic connection * management; however, detailed interpretations of headers * and methods are left to clients).<p> * * All functions are guaranteed to be completely reentrant and * thread-safe.<p> * * TODO: * - Add option codes for buffer sizes and SSL support */#ifndef MHD_MICROHTTPD_H#define MHD_MICROHTTPD_H#include <sys/types.h>#ifndef MINGW#include <sys/select.h>#include <sys/socket.h>#else#include "plibc.h"#endif#ifdef __cplusplusextern "C"{#if 0                           /* keep Emacsens' auto-indent happy */}#endif#endif/** * Current version of the library. */#define MHD_VERSION 0x00000000/** * MHD-internal return codes. */#define MHD_YES 1#define MHD_NO 0/** * HTTP response codes. */#define MHD_HTTP_CONTINUE 100#define MHD_HTTP_SWITCHING_PROTOCOLS 101#define MHD_HTTP_PROCESSING 102#define MHD_HTTP_OK 200#define MHD_HTTP_CREATED 201#define MHD_HTTP_ACCEPTED 202#define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203#define MHD_HTTP_NO_CONTENT 204#define MHD_HTTP_RESET_CONTENT 205#define MHD_HTTP_PARTIAL_CONTENT 206#define MHD_HTTP_MULTI_STATUS 207#define MHD_HTTP_MULTIPLE_CHOICES 300#define MHD_HTTP_MOVED_PERMANENTLY 301#define MHD_HTTP_FOUND 302#define MHD_HTTP_SEE_OTHER 303#define MHD_HTTP_NOT_MODIFIED 304#define MHD_HTTP_USE_PROXY 305#define MHD_HTTP_SWITCH_PROXY 306#define MHD_HTTP_TEMPORARY_REDIRECT 307#define MHD_HTTP_BAD_REQUEST 400#define MHD_HTTP_UNAUTHORIZED 401#define MHD_HTTP_PAYMENT_REQUIRED 402#define MHD_HTTP_FORBIDDEN 403#define MHD_HTTP_NOT_FOUND 404#define MHD_HTTP_METHOD_NOT_ALLOWED 405#define MHD_HTTP_METHOD_NOT_ACCEPTABLE 406#define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407#define MHD_HTTP_REQUEST_TIMEOUT 408#define MHD_HTTP_CONFLICT 409#define MHD_HTTP_GONE 410#define MHD_HTTP_LENGTH_REQUIRED 411#define MHD_HTTP_PRECONDITION_FAILED 412#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413#define MHD_HTTP_REQUEST_URI_TOO_LONG 414#define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416#define MHD_HTTP_EXPECTATION_FAILED 417#define MHD_HTTP_UNPROCESSABLE_ENTITY 422#define MHD_HTTP_LOCKED 423#define MHD_HTTP_FAILED_DEPENDENCY 424#define MHD_HTTP_UNORDERED_COLLECTION 425#define MHD_HTTP_UPGRADE_REQUIRED 426#define MHD_HTTP_RETRY_WITH 449#define MHD_HTTP_INTERNAL_SERVER_ERROR 500#define MHD_HTTP_NOT_IMPLEMENTED 501#define MHD_HTTP_BAD_GATEWAY 502#define MHD_HTTP_SERVICE_UNAVAILABLE 503#define MHD_HTTP_GATEWAY_TIMEOUT 504#define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505#define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506#define MHD_HTTP_INSUFFICIENT_STORAGE 507#define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509#define MHD_HTTP_NOT_EXTENDED 510/* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */#define MHD_HTTP_HEADER_ACCEPT "Accept"#define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"#define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding"#define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language"#define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"#define MHD_HTTP_HEADER_AGE "Age"#define MHD_HTTP_HEADER_ALLOW "Allow"#define MHD_HTTP_HEADER_AUTHORIZATION "Authorization"#define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control"#define MHD_HTTP_HEADER_CONNECTION "Connection"#define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"#define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language"#define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length"#define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location"#define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5"#define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range"#define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type"#define MHD_HTTP_HEADER_DATE "Date"#define MHD_HTTP_HEADER_ETAG "ETag"#define MHD_HTTP_HEADER_EXPECT "Expect"#define MHD_HTTP_HEADER_EXPIRES "Expires"#define MHD_HTTP_HEADER_FROM "From"#define MHD_HTTP_HEADER_HOST "Host"#define MHD_HTTP_HEADER_IF_MATCH "If-Match"#define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since"#define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match"#define MHD_HTTP_HEADER_IF_RANGE "If-Range"#define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since"#define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified"#define MHD_HTTP_HEADER_LOCATION "Location"#define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards"#define MHD_HTTP_HEADER_PRAGMA "Pragma"#define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate"#define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization"#define MHD_HTTP_HEADER_RANGE "Range"#define MHD_HTTP_HEADER_REFERER "Referer"#define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After"#define MHD_HTTP_HEADER_SERVER "Server"#define MHD_HTTP_HEADER_TE "TE"#define MHD_HTTP_HEADER_TRAILER "Trailer"#define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"#define MHD_HTTP_HEADER_UPGRADE "Upgrade"#define MHD_HTTP_HEADER_USER_AGENT "User-Agent"#define MHD_HTTP_HEADER_VARY "Vary"#define MHD_HTTP_HEADER_VIA "Via"#define MHD_HTTP_HEADER_WARNING "Warning"#define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate"/** * HTTP versions (used to match against the first line of the * HTTP header as well as in the response code). */#define MHD_HTTP_VERSION_1_0 "HTTP/1.0"#define MHD_HTTP_VERSION_1_1 "HTTP/1.1"/** * HTTP methods */#define MHD_HTTP_METHOD_CONNECT "CONNECT"#define MHD_HTTP_METHOD_DELETE "DELETE"#define MHD_HTTP_METHOD_GET "GET"#define MHD_HTTP_METHOD_HEAD "HEAD"#define MHD_HTTP_METHOD_OPTIONS "OPTIONS"#define MHD_HTTP_METHOD_POST "POST"#define MHD_HTTP_METHOD_PUT "PUT"#define MHD_HTTP_METHOD_TRACE "TRACE"/** * HTTP POST encodings, see also * http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 */#define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded"#define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data"/** * Options for the MHD daemon.  Note that if neither * MHD_USER_THREAD_PER_CONNECTION nor MHD_USE_SELECT_INTERNALLY are * used, the client wants control over the process and will call the * appropriate microhttpd callbacks.<p> * * Starting the daemon may also fail if a particular option is not * implemented or not supported on the target platform (i.e. no * support for SSL, threads or IPv6). */enum MHD_FLAG{  /**   * No options selected.   */  MHD_NO_FLAG = 0,  /**   * Run in debug mode.  If this flag is used, the   * library should print error messages and warnings   * to stderr.   */  MHD_USE_DEBUG = 1,  /**   * Run in https mode.   */  MHD_USE_SSL = 2,  /**   * Run using one thread per connection.   */  MHD_USE_THREAD_PER_CONNECTION = 4,  /**   * Run using an internal thread doing SELECT.   */  MHD_USE_SELECT_INTERNALLY = 8,  /**   * Run using the IPv6 protocol (otherwise, MHD will   * just support IPv4).   */  MHD_USE_IPv6 = 16,};/** * MHD options.  Passed in the varargs portion  * of MHD_start_daemon. */enum MHD_OPTION{  /**   * No more options / last option.  This is used   * to terminate the VARARGs list.   */  MHD_OPTION_END = 0,  /**   * Maximum memory size per connection (followed by an   * unsigned int).   */  MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1,  /**   * Maximum number of concurrenct connections to   * accept (followed by an unsigned int).   */  MHD_OPTION_CONNECTION_LIMIT = 2,};/** * The MHD_ValueKind specifies the source of * the key-value pairs in the HTTP protocol. */enum MHD_ValueKind{  /**   * Response header   */  MHD_RESPONSE_HEADER_KIND = 0,  /**   * HTTP header.   */  MHD_HEADER_KIND = 1,  /**   * Cookies.  Note that the original HTTP header containing   * the cookie(s) will still be available and intact.   */  MHD_COOKIE_KIND = 2,  /**   * POST data.  This is available only if a content encoding   * supported by MHD is used (currently only URL encoding),   * and only if the posted content fits within the available   * memory pool.  Note that in that case, the upload data   * given to the MHD_AccessHandlerCallback will be   * empty (since it has already been processed).   */  MHD_POSTDATA_KIND = 4,  /**   * GET (URI) arguments.   */  MHD_GET_ARGUMENT_KIND = 8,};/**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -