Helper functions for HTTP client. More...
#include <limits.h>
#include <stdlib.h>
#include "core/net.h"
#include "http/http_client.h"
#include "http/http_client_auth.h"
#include "http/http_client_transport.h"
#include "http/http_client_misc.h"
#include "str.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL HTTP_TRACE_LEVEL |
Detailed Description
Helper functions for HTTP client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 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
- 2.4.4
Definition in file http_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL HTTP_TRACE_LEVEL |
Definition at line 32 of file http_client_misc.c.
Function Documentation
◆ httpClientChangeRequestState()
void httpClientChangeRequestState | ( | HttpClientContext * | context, |
HttpRequestState | newState | ||
) |
Update HTTP request state.
- Parameters
-
[in] context Pointer to the HTTP client context [in] newState New state to switch to
Definition at line 72 of file http_client_misc.c.
◆ httpClientChangeState()
void httpClientChangeState | ( | HttpClientContext * | context, |
HttpClientState | newState | ||
) |
Update HTTP client state.
- Parameters
-
[in] context Pointer to the HTTP client context [in] newState New state to switch to
Definition at line 55 of file http_client_misc.c.
◆ httpClientCheckTimeout()
error_t httpClientCheckTimeout | ( | HttpClientContext * | context | ) |
Determine whether a timeout error has occurred.
- Parameters
-
[in] context Pointer to the HTTP client context
- Returns
- Error code
Definition at line 585 of file http_client_misc.c.
◆ httpClientFormatChunkSize()
error_t httpClientFormatChunkSize | ( | HttpClientContext * | context, |
size_t | length | ||
) |
Format chunk-size field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] length Size of the chunk
- Returns
- Error code
Definition at line 155 of file http_client_misc.c.
◆ httpClientFormatRequestHeader()
error_t httpClientFormatRequestHeader | ( | HttpClientContext * | context | ) |
Format default HTTP request header.
- Parameters
-
[in] context Pointer to the HTTP client context
- Returns
- Error code
Definition at line 89 of file http_client_misc.c.
◆ httpClientParseChunkSize()
error_t httpClientParseChunkSize | ( | HttpClientContext * | context, |
char_t * | line, | ||
size_t | length | ||
) |
Parse chunk-size field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] line Pointer to the chunk-size field [in] length Length of the chunk-size field
- Returns
- Error code
Definition at line 538 of file http_client_misc.c.
◆ httpClientParseConnectionField()
error_t httpClientParseConnectionField | ( | HttpClientContext * | context, |
const char_t * | value | ||
) |
Parse Connection header field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] value NULL-terminated string that contains the field value
- Returns
- Error code
Definition at line 426 of file http_client_misc.c.
◆ httpClientParseContentLengthField()
error_t httpClientParseContentLengthField | ( | HttpClientContext * | context, |
const char_t * | value | ||
) |
Parse Content-Length header field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] value NULL-terminated string that contains the field value
- Returns
- Error code
Definition at line 507 of file http_client_misc.c.
◆ httpClientParseHeaderField()
error_t httpClientParseHeaderField | ( | HttpClientContext * | context, |
char_t * | line, | ||
size_t | length | ||
) |
Parse HTTP response header field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] line Pointer to the header field [in] length Length of the header field
- Returns
- Error code
Definition at line 296 of file http_client_misc.c.
◆ httpClientParseStatusLine()
error_t httpClientParseStatusLine | ( | HttpClientContext * | context, |
char_t * | line, | ||
size_t | length | ||
) |
Parse HTTP status line.
- Parameters
-
[in] context Pointer to the HTTP client context [in] line Pointer to the status line [in] length Length of the status line
- Returns
- Error code
Definition at line 212 of file http_client_misc.c.
◆ httpClientParseTransferEncodingField()
error_t httpClientParseTransferEncodingField | ( | HttpClientContext * | context, |
const char_t * | value | ||
) |
Parse Transfer-Encoding header field.
- Parameters
-
[in] context Pointer to the HTTP client context [in] value NULL-terminated string that contains the field value
- Returns
- Error code
Definition at line 477 of file http_client_misc.c.