http_server_misc.h
Go to the documentation of this file.
1 /**
2  * @file http_server_misc.h
3  * @brief HTTP server (miscellaneous functions)
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _HTTP_SERVER_MISC_H
30 #define _HTTP_SERVER_MISC_H
31 
32 //Dependencies
33 #include "http/http_server.h"
34 
35 //C++ guard
36 #ifdef __cplusplus
37  extern "C" {
38 #endif
39 
40 //HTTP server related functions
42 error_t httpParseRequestLine(HttpConnection *connection, char_t *requestLine);
43 
45  char_t *buffer, size_t size, char_t *firstChar);
46 
47 void httpParseHeaderField(HttpConnection *connection,
48  const char_t *name, char_t *value);
49 
51  char_t *value);
52 
54  char_t *value);
55 
57  char_t *value);
58 
60 
61 void httpInitResponseHeader(HttpConnection *connection);
63 
64 error_t httpSend(HttpConnection *connection,
65  const void *data, size_t length, uint_t flags);
66 
68  void *data, size_t size, size_t *received, uint_t flags);
69 
70 void httpGetAbsolutePath(HttpConnection *connection,
71  const char_t *relative, char_t *absolute, size_t maxLen);
72 
73 bool_t httpCompExtension(const char_t *filename, const char_t *extension);
74 
76  char_t *output, size_t outputSize);
77 
78 void httpConvertArrayToHexString(const uint8_t *input,
79  size_t inputLen, char_t *output);
80 
81 //C++ guard
82 #ifdef __cplusplus
83  }
84 #endif
85 
86 #endif
char_t filename[]
Definition: tftp_common.h:89
error_t httpReceive(HttpConnection *connection, void *data, size_t size, size_t *received, uint_t flags)
Receive data from the client.
char char_t
Definition: compiler_port.h:41
uint8_t flags
Definition: tcp.h:312
error_t httpReadChunkSize(HttpConnection *connection)
Read chunk-size field from the input stream.
error_t httpDecodePercentEncodedString(const char_t *input, char_t *output, size_t outputSize)
Decode a percent-encoded string.
HTTP server (HyperText Transfer Protocol)
void httpParseHeaderField(HttpConnection *connection, const char_t *name, char_t *value)
Parse HTTP header field.
bool_t httpCompExtension(const char_t *filename, const char_t *extension)
Compare filename extension.
error_t httpReadHeaderField(HttpConnection *connection, char_t *buffer, size_t size, char_t *firstChar)
Read multiple-line header field.
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.
char_t name[]
error_t httpParseRequestLine(HttpConnection *connection, char_t *requestLine)
Parse Request-Line.
void httpGetAbsolutePath(HttpConnection *connection, const char_t *relative, char_t *absolute, size_t maxLen)
Retrieve the full pathname to the specified resource.
error_t
Error codes.
Definition: error.h:40
unsigned int uint_t
Definition: compiler_port.h:43
uint8_t data[]
Definition: dtls_misc.h:167
#define HttpConnection
Definition: http_server.h:296
uint8_t value[]
Definition: dtls_misc.h:141
void httpInitResponseHeader(HttpConnection *connection)
Initialize response header.
void httpParseConnectionField(HttpConnection *connection, char_t *value)
Parse Connection header field.
void httpConvertArrayToHexString(const uint8_t *input, size_t inputLen, char_t *output)
Convert byte array to hex string.
uint8_t length
Definition: dtls_misc.h:140
void httpParseContentTypeField(HttpConnection *connection, char_t *value)
Parse Content-Type header field.
int bool_t
Definition: compiler_port.h:47
error_t httpReadRequestHeader(HttpConnection *connection)
Read HTTP request header and parse its contents.
void httpParseAcceptEncodingField(HttpConnection *connection, char_t *value)
Parse Accept-Encoding header field.