http_client_misc.h File Reference

Helper functions for HTTP client. More...

#include "core/net.h"
#include "http/http_client.h"

Go to the source code of this file.

Functions

void httpClientChangeState (HttpClientContext *context, HttpClientState newState)
 Update HTTP client state. More...
 
void httpClientChangeRequestState (HttpClientContext *context, HttpRequestState newState)
 Update HTTP request state. More...
 
error_t httpClientFormatRequestHeader (HttpClientContext *context)
 Format default HTTP request header. More...
 
error_t httpClientFormatChunkSize (HttpClientContext *context, size_t length)
 Format chunk-size field. More...
 
error_t httpClientParseStatusLine (HttpClientContext *context, char_t *line, size_t length)
 Parse HTTP status line. More...
 
error_t httpClientParseHeaderField (HttpClientContext *context, char_t *line, size_t length)
 Parse HTTP response header field. More...
 
error_t httpClientParseConnectionField (HttpClientContext *context, const char_t *value)
 Parse Connection header field. More...
 
error_t httpClientParseTransferEncodingField (HttpClientContext *context, const char_t *value)
 Parse Transfer-Encoding header field. More...
 
error_t httpClientParseContentLengthField (HttpClientContext *context, const char_t *value)
 Parse Content-Length header field. More...
 
error_t httpClientParseChunkSize (HttpClientContext *context, char_t *line, size_t length)
 Parse chunk-size field. More...
 
error_t httpClientCheckTimeout (HttpClientContext *context)
 Determine whether a timeout error has occurred. More...
 

Detailed Description

Helper functions for HTTP client.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2019 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.2

Definition in file http_client_misc.h.

Function Documentation

◆ httpClientChangeRequestState()

void httpClientChangeRequestState ( HttpClientContext context,
HttpRequestState  newState 
)

Update HTTP request state.

Parameters
[in]contextPointer to the HTTP client context
[in]newStateNew 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]contextPointer to the HTTP client context
[in]newStateNew 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]contextPointer to the HTTP client context
Returns
Error code

Definition at line 581 of file http_client_misc.c.

◆ httpClientFormatChunkSize()

error_t httpClientFormatChunkSize ( HttpClientContext context,
size_t  length 
)

Format chunk-size field.

Parameters
[in]contextPointer to the HTTP client context
[in]lengthSize 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]contextPointer 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]contextPointer to the HTTP client context
[in]linePointer to the chunk-size field
[in]lengthLength of the chunk-size field
Returns
Error code

Definition at line 534 of file http_client_misc.c.

◆ httpClientParseConnectionField()

error_t httpClientParseConnectionField ( HttpClientContext context,
const char_t value 
)

Parse Connection header field.

Parameters
[in]contextPointer to the HTTP client context
[in]valueNULL-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]contextPointer to the HTTP client context
[in]valueNULL-terminated string that contains the field value
Returns
Error code

Definition at line 503 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]contextPointer to the HTTP client context
[in]linePointer to the header field
[in]lengthLength 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]contextPointer to the HTTP client context
[in]linePointer to the status line
[in]lengthLength 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]contextPointer to the HTTP client context
[in]valueNULL-terminated string that contains the field value
Returns
Error code

Definition at line 473 of file http_client_misc.c.