Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HTTP server (miscellaneous functions) More...
Go to the source code of this file.
Functions | |
error_t | httpReadRequestHeader (HttpConnection *connection) |
Read HTTP request header and parse its contents. | |
error_t | httpParseRequestLine (HttpConnection *connection, char_t *requestLine) |
Parse Request-Line. | |
error_t | httpReadHeaderField (HttpConnection *connection, char_t *buffer, size_t size, char_t *firstChar) |
Read multiple-line header field. | |
void | httpParseHeaderField (HttpConnection *connection, const char_t *name, char_t *value) |
Parse HTTP header field. | |
void | httpParseConnectionField (HttpConnection *connection, char_t *value) |
Parse Connection header field. | |
void | httpParseContentTypeField (HttpConnection *connection, char_t *value) |
Parse Content-Type header field. | |
error_t | httpReadChunkSize (HttpConnection *connection) |
Read chunk-size field from the input stream. | |
void | httpInitResponseHeader (HttpConnection *connection) |
Initialize response header. | |
error_t | httpFormatResponseHeader (HttpConnection *connection, char_t *buffer) |
Format HTTP response header. | |
error_t | httpSend (HttpConnection *connection, const void *data, size_t length, uint_t flags) |
Send data to the client. | |
error_t | httpReceive (HttpConnection *connection, void *data, size_t size, size_t *received, uint_t flags) |
Receive data from the client. | |
void | httpGetAbsolutePath (HttpConnection *connection, const char_t *relative, char_t *absolute, size_t maxLen) |
Retrieve the full pathname to the specified resource. | |
bool_t | httpCompExtension (const char_t *filename, const char_t *extension) |
Compare filename extension. | |
error_t | httpDecodePercentEncodedString (const char_t *input, char_t *output, size_t outputSize) |
Decode a percent-encoded string. | |
void | httpConvertArrayToHexString (const uint8_t *input, size_t inputLength, char_t *output) |
Convert byte array to hex string. | |
Variables | |
static const HttpStatusCodeDesc | statusCodeList [] |
HTTP status codes. |
Detailed Description
HTTP server (miscellaneous functions)
License
Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program 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 of the License, or (at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version:
- 1.7.6
Definition in file http_server_misc.c.
Function Documentation
bool_t httpCompExtension | ( | const char_t * | filename, |
const char_t * | extension | ||
) |
Compare filename extension.
- Parameters:
-
[in] filename Filename whose extension is to be checked [in] extension String defining the extension to be checked
- Returns:
- TRUE is the filename matches the given extension, else FALSE
Definition at line 954 of file http_server_misc.c.
void httpConvertArrayToHexString | ( | const uint8_t * | input, |
size_t | inputLength, | ||
char_t * | output | ||
) |
Convert byte array to hex string.
- Parameters:
-
[in] input Point to the byte array [in] inputLength Length of the byte array [out] output NULL-terminated string resulting from the conversion
- Returns:
- Error code
Definition at line 1044 of file http_server_misc.c.
error_t httpDecodePercentEncodedString | ( | const char_t * | input, |
char_t * | output, | ||
size_t | outputSize | ||
) |
Decode a percent-encoded string.
- Parameters:
-
[in] input NULL-terminated string to be decoded [out] output NULL-terminated string resulting from the decoding process [in] outputSize Size of the output buffer in bytes
- Returns:
- Error code
Definition at line 984 of file http_server_misc.c.
error_t httpFormatResponseHeader | ( | HttpConnection * | connection, |
char_t * | buffer | ||
) |
Format HTTP response header.
- Parameters:
-
[in] connection Structure representing an HTTP connection [out] buffer Pointer to the buffer where to format the HTTP header
- Returns:
- Error code
Definition at line 708 of file http_server_misc.c.
void httpGetAbsolutePath | ( | HttpConnection * | connection, |
const char_t * | relative, | ||
char_t * | absolute, | ||
size_t | maxLen | ||
) |
Retrieve the full pathname to the specified resource.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] relative String containing the relative path to the resource [out] absolute Resulting string containing the absolute path [in] maxLen Maximum acceptable path length
Definition at line 933 of file http_server_misc.c.
void httpInitResponseHeader | ( | HttpConnection * | connection ) |
Initialize response header.
- Parameters:
-
[in] connection Structure representing an HTTP connection
Definition at line 680 of file http_server_misc.c.
void httpParseConnectionField | ( | HttpConnection * | connection, |
char_t * | value | ||
) |
Parse Connection header field.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] value Content-Type field value
Definition at line 485 of file http_server_misc.c.
void httpParseContentTypeField | ( | HttpConnection * | connection, |
char_t * | value | ||
) |
Parse Content-Type header field.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] value Content-Type field value
Definition at line 531 of file http_server_misc.c.
void httpParseHeaderField | ( | HttpConnection * | connection, |
const char_t * | name, | ||
char_t * | value | ||
) |
Parse HTTP header field.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] name Name of the header field [in] value Value of the header field
- Returns:
- Error code
Definition at line 419 of file http_server_misc.c.
error_t httpParseRequestLine | ( | HttpConnection * | connection, |
char_t * | requestLine | ||
) |
Parse Request-Line.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] requestLine Pointer to the string that holds the Request-Line
- Returns:
- Error code
Definition at line 199 of file http_server_misc.c.
error_t httpReadChunkSize | ( | HttpConnection * | connection ) |
Read chunk-size field from the input stream.
- Parameters:
-
[in] connection Structure representing an HTTP connection
Definition at line 599 of file http_server_misc.c.
error_t httpReadHeaderField | ( | HttpConnection * | connection, |
char_t * | buffer, | ||
size_t | size, | ||
char_t * | firstChar | ||
) |
Read multiple-line header field.
- Parameters:
-
[in] connection Structure representing an HTTP connection [out] buffer Buffer where to store the header field [in] size Size of the buffer, in bytes [in,out] firstChar Leading character of the header line
- Returns:
- Error code
Definition at line 316 of file http_server_misc.c.
error_t httpReadRequestHeader | ( | HttpConnection * | connection ) |
Read HTTP request header and parse its contents.
- Parameters:
-
[in] connection Structure representing an HTTP connection
- Returns:
- Error code
Definition at line 82 of file http_server_misc.c.
error_t httpReceive | ( | HttpConnection * | connection, |
void * | data, | ||
size_t | size, | ||
size_t * | received, | ||
uint_t | flags | ||
) |
Receive data from the client.
- Parameters:
-
[in] connection Structure representing an HTTP connection [out] data Buffer into which received data will be placed [in] size Maximum number of bytes that can be received [out] received Actual number of bytes that have been received [in] flags Set of flags that influences the behavior of this function
- Returns:
- Error code
Definition at line 901 of file http_server_misc.c.
error_t httpSend | ( | HttpConnection * | connection, |
const void * | data, | ||
size_t | length, | ||
uint_t | flags | ||
) |
Send data to the client.
- Parameters:
-
[in] connection Structure representing an HTTP connection [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of bytes to be transmitted [in] flags Set of flags that influences the behavior of this function
Definition at line 853 of file http_server_misc.c.
Variable Documentation
const HttpStatusCodeDesc statusCodeList[] [static] |
{ {200, "OK"}, {201, "Created"}, {202, "Accepted"}, {204, "No Content"}, {301, "Moved Permanently"}, {302, "Found"}, {304, "Not Modified"}, {400, "Bad Request"}, {401, "Unauthorized"}, {403, "Forbidden"}, {404, "Not Found"}, {500, "Internal Server Error"}, {501, "Not Implemented"}, {502, "Bad Gateway"}, {503, "Service Unavailable"} }
HTTP status codes.
Definition at line 52 of file http_server_misc.c.
Generated on Tue Jul 12 2022 17:10:20 by
