Network Services API  2.75.00.17
Data Structures | Macros | Typedefs | Functions | Variables
HTTP Client

The HTTP client provides APIs to connect to, and communicate with, HTTP Servers. More...

Data Structures

struct  HTTPClient_extSecParams
 

Macros

#define HTTPClient_DOMAIN_BUFLEN   (100)
 
#define HTTPClient_RES_HFIELD_BUFFER_SIZE   (300)
 
#define HTTPClient_MIN_USER_WORKSPACE_SIZE   (500)
 
#define HTTPClient_MAX_REDIRECTION_ATTEMPTS   (3)
 
#define HTTPClient_MAX_REQUEST_ATTEMPTS   (2)
 
#define HTTPClient_MAX_RESPONSE_HEADER_FILEDS   (25)
 
#define HTTPClient_PORT   (80)
 
#define HTTPClient_SECURE_PORT   (443)
 
#define HTTPClient_HFIELD_RES_AGE   (0)
 Age HTTP response header More...
 
#define HTTPClient_HFIELD_RES_ALLOW   (1)
 Allow HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CACHE_CONTROL   (2)
 Cache-Control HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONNECTION   (3)
 Connection HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_ENCODING   (4)
 Content-Encoding HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_LANGUAGE   (5)
 Content-Language HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_LENGTH   (6)
 Content-Length HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_LOCATION   (7)
 Content-Location HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_RANGE   (8)
 Content-Range HTTP response header More...
 
#define HTTPClient_HFIELD_RES_CONTENT_TYPE   (9)
 Content-Type HTTP response header More...
 
#define HTTPClient_HFIELD_RES_DATE   (10)
 Date HTTP response header More...
 
#define HTTPClient_HFIELD_RES_ETAG   (11)
 ETag HTTP response header More...
 
#define HTTPClient_HFIELD_RES_EXPIRES   (12)
 Expires HTTP response header More...
 
#define HTTPClient_HFIELD_RES_LAST_MODIFIED   (13)
 Last-Modified HTTP response header More...
 
#define HTTPClient_HFIELD_RES_LOCATION   (14)
 Location HTTP response header More...
 
#define HTTPClient_HFIELD_RES_PROXY_AUTHENTICATE   (15)
 Proxy-Authenticate HTTP response header More...
 
#define HTTPClient_HFIELD_RES_RETRY_AFTER   (16)
 Retry-After HTTP response header More...
 
#define HTTPClient_HFIELD_RES_SERVER   (17)
 Server HTTP response header More...
 
#define HTTPClient_HFIELD_RES_SET_COOKIE   (18)
 Set-Cookie HTTP response header More...
 
#define HTTPClient_HFIELD_RES_TRAILER   (19)
 Trailer HTTP response header More...
 
#define HTTPClient_HFIELD_RES_TRANSFER_ENCODING   (20)
 Transfer-Encoding HTTP response header More...
 
#define HTTPClient_HFIELD_RES_UPGRADE   (21)
 Upgrade HTTP response header More...
 
#define HTTPClient_HFIELD_RES_VARY   (22)
 Vary HTTP response header More...
 
#define HTTPClient_HFIELD_RES_VIA   (23)
 Via HTTP response header More...
 
#define HTTPClient_HFIELD_RES_WWW_AUTHENTICATE   (24)
 Www-Authenticate HTTP response header More...
 
#define HTTPClient_HFIELD_RES_WARNING   (25)
 Warning HTTP response header More...
 
#define HTTPClient_REQUEST_HEADER_MASK   (0x80000000)
 
#define HTTPClient_HFIELD_REQ_ACCEPT   (26 | HTTPClient_REQUEST_HEADER_MASK)
 Accept HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_ACCEPT_CHARSET   (27 | HTTPClient_REQUEST_HEADER_MASK)
 Accept-Charset HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_ACCEPT_ENCODING   (28 | HTTPClient_REQUEST_HEADER_MASK)
 Accept-Encoding HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_ACCEPT_LANGUAGE   (29 | HTTPClient_REQUEST_HEADER_MASK)
 Accept-Language HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_ALLOW   (HTTPClient_HFIELD_RES_ALLOW | HTTPClient_REQUEST_HEADER_MASK)
 Allow HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_AUTHORIZATION   (30 | HTTPClient_REQUEST_HEADER_MASK)
 Authorization HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CACHE_CONTROL   (HTTPClient_HFIELD_RES_CACHE_CONTROL | HTTPClient_REQUEST_HEADER_MASK)
 Cache-Control HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CONNECTION   (HTTPClient_HFIELD_RES_CONNECTION | HTTPClient_REQUEST_HEADER_MASK)
 Connection HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CONTENT_ENCODING   (HTTPClient_HFIELD_RES_CONTENT_ENCODING | HTTPClient_REQUEST_HEADER_MASK)
 Content-Encoding HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CONTENT_LANGUAGE   (HTTPClient_HFIELD_RES_CONTENT_LANGUAGE | HTTPClient_REQUEST_HEADER_MASK)
 Content-Language HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CONTENT_LOCATION   (HTTPClient_HFIELD_RES_CONTENT_LOCATION | HTTPClient_REQUEST_HEADER_MASK)
 Location HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_CONTENT_TYPE   (HTTPClient_HFIELD_RES_CONTENT_TYPE | HTTPClient_REQUEST_HEADER_MASK)
 Content-Type HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_COOKIE   (31 | HTTPClient_REQUEST_HEADER_MASK)
 Cookie HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_DATE   (HTTPClient_HFIELD_RES_DATE | HTTPClient_REQUEST_HEADER_MASK)
 Date HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_EXPECT   (32 | HTTPClient_REQUEST_HEADER_MASK)
 Expect HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_FORWARDED   (33 | HTTPClient_REQUEST_HEADER_MASK)
 Forwarded HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_FROM   (34 | HTTPClient_REQUEST_HEADER_MASK)
 From HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_HOST   (35 | HTTPClient_REQUEST_HEADER_MASK)
 Host HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_IF_MATCH   (36 | HTTPClient_REQUEST_HEADER_MASK)
 If-Match HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_IF_MODIFIED_SINCE   (37 | HTTPClient_REQUEST_HEADER_MASK)
 If-Modified-Since HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_IF_NONE_MATCH   (38 | HTTPClient_REQUEST_HEADER_MASK)
 If-None-Match HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_IF_RANGE   (39 | HTTPClient_REQUEST_HEADER_MASK)
 If-Range HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_IF_UNMODIFIED_SINCE   (40 | HTTPClient_REQUEST_HEADER_MASK)
 If-Unmodified-Since HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_ORIGIN   (41 | HTTPClient_REQUEST_HEADER_MASK)
 Origin HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_PROXY_AUTHORIZATION   (42 | HTTPClient_REQUEST_HEADER_MASK)
 Proxy-Authorization HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_RANGE   (43 | HTTPClient_REQUEST_HEADER_MASK)
 Range HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_TE   (44 | HTTPClient_REQUEST_HEADER_MASK)
 TE HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_TRANSFER_ENCODING   (HTTPClient_HFIELD_RES_TRANSFER_ENCODING | HTTPClient_REQUEST_HEADER_MASK)
 Transfer-Encoding HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_UPGRADE   (HTTPClient_HFIELD_RES_UPGRADE | HTTPClient_REQUEST_HEADER_MASK)
 Upgrade HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_USER_AGENT   (45 | HTTPClient_REQUEST_HEADER_MASK)
 User-Agent HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_VIA   (HTTPClient_HFIELD_RES_VIA | HTTPClient_REQUEST_HEADER_MASK)
 Via HTTP request header More...
 
#define HTTPClient_HFIELD_REQ_WARNING   (HTTPClient_HFIELD_RES_WARNING | HTTPClient_REQUEST_HEADER_MASK)
 Warning HTTP request header More...
 
#define HTTPClient_MAX_NUMBER_OF_HEADER_FIELDS   (46)
 
#define HTTPClient_REDIRECT_FEATURE   (48)
 
#define HTTPClient_RESPONSE_FILTER_CLEAR   (49)
 
#define HTTPClient_REDIRECT_TLS_DOWNGRADE   (50)
 
#define HTTPClient_AUTHENTICATE_SERVER_CALLBACK   (51)
 Attaches callback which will handle the server authentication response (401) More...
 
#define HTTPClient_ESENDBUFSMALL   (-3001)
 Internal send buffer is not big enough. More...
 
#define HTTPClient_EGETOPTBUFSMALL   (-3002)
 Buffer inserted into HTTPClient_getOpt() is not big enough. More...
 
#define HTTPClient_ERESPONSEINVALID   (-3003)
 Response received from the server is not a valid HTTP/1.1 or HTTP/1.0 response. More...
 
#define HTTPClient_EINPROGRESS   (-3004)
 Operation could not be completed. Try again. More...
 
#define HTTPClient_EDOMAINBUFSMALL   (-3005)
 Input domain name length is too long to be read into buffer. More...
 
#define HTTPClient_ECBALLOCATIONFAILED   (-3006)
 Allocation failed during the CB creation. More...
 
#define HTTPClient_EBODYBUFSMALL   (-3008)
 Body size is too small. More...
 
#define HTTPClient_ENULLPOINTER   (-3009)
 Invalid de-referencing a NULL pointer. More...
 
#define HTTPClient_EREQUESTHEADERALLOCFAILED   (-3010)
 Request header allocation failed. More...
 
#define HTTPClient_EREQHEADERNOTFOUND   (-3011)
 Request header wasn't found in the req header list. More...
 
#define HTTPClient_EHOSTNOTFOUND   (-3012)
 Host request header wasn't found. More...
 
#define HTTPClient_ECLIENTALREADYCONNECTED   (-3013)
 Client is already connected. More...
 
#define HTTPClient_ERESPONSEISNOTREDIRECTABLE   (-3014)
 Response is not redirectable. More...
 
#define HTTPClient_ESENDERROR   (-3015)
 Send couldn't be completed. More...
 
#define HTTPClient_EREDIRECTLOCATIONFAIL   (-3016)
 Location Header fields value couldn't be read completely. More...
 
#define HTTPClient_ETLSDOWNGRADEISFORBIDDEN   (-3017)
 TLS downgrade is forbidden. More...
 
#define HTTPClient_EWRONGAPIPARAMETER   (-3018)
 Wrong API parameter. More...
 
#define HTTPClient_EHOSTHEADERALREADYEXIST   (-3019)
 HOST already exist. More...
 
#define HTTPClient_ENOCONNECTION   (-3020)
 Client is disconnected. More...
 
#define HTTPClient_ENOTABSOLUTEURI   (-3021)
 URI is not absolute. More...
 
#define HTTPClient_ECANTCREATESECATTRIB   (-3022)
 Error during creation of security attribute. More...
 
#define HTTPClient_EINTERNAL   (-3023)
 General internal error. More...
 
#define HTTPClient_EGETCUSOMHEADERBUFSMALL   (-3024)
 Buffer inserted into HTTPClient_getHeaderByName(..) is not big enough. More...
 
#define HTTPClient_ENOHEADERNAMEDASINSERTED   (-3025)
 Custom response header name on HTTPClient_getHeaderByName(..) dosn't set before. More...
 
#define HTTPClient_IGNORE_PROXY   (0x01)
 
#define HTTPClient_HOST_EXIST   (0x02)
 
#define HTTPClient_HFIELD_NOT_PERSISTENT   (0x01)
 
#define HTTPClient_HFIELD_PERSISTENT   (0x02)
 
#define HTTPClient_CUSTOM_RESPONSE_HEADER   (0x01)
 
#define HTTPClient_CHUNK_START   (0x01)
 
#define HTTPClient_CHUNK_END   (0x02)
 
#define HTTPClient_DROP_BODY   (0x04)
 

Typedefs

typedef struct HTTPClient_extSecParams HTTPClient_extSecParams
 
typedef int16_t(* HTTPClient_authenticationCallback) (const char *serverAuthBuff, uint32_t serverAuthLen, char *clientAuthBuff, uint32_t *clientAuthLen)
 HTTPClient callback for server authentication handling This function is responsible for generating the value for the authorization request header. More...
 
typedef void * HTTPClient_Handle
 

Functions

HTTPClient_Handle HTTPClient_create (int16_t *status, void *params)
 Allocate and initialize a new HTTPClient instance object and return its handle. More...
 
int16_t HTTPClient_destroy (HTTPClient_Handle client)
 Destroy the HTTP client instance and free the previously allocated instance object. More...
 
int16_t HTTPClient_connect2 (HTTPClient_Handle client, const char *hostName, SlNetSockSecAttrib_t *secAttribs, uint32_t flags, int16_t *secureRetVal)
 Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both. HTTPClient_connect2 allows the user more control over security by accepting a secure attribute object and returning the value of the attempted secure connection. More...
 
int16_t HTTPClient_connect (HTTPClient_Handle client, const char *hostName, HTTPClient_extSecParams *exSecParams, uint32_t flags)
 Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both. More...
 
int16_t HTTPClient_disconnect (HTTPClient_Handle client)
 Disconnect from the HTTP server. More...
 
int16_t HTTPClient_sendRequest (HTTPClient_Handle client, const char *method, const char *requestURI, const char *body, uint32_t bodyLen, uint32_t flags)
 Make an HTTP request to the HTTP server. More...
 
int16_t HTTPClient_readResponseBody (HTTPClient_Handle client, char *body, uint32_t bodyLen, bool *moreDataFlag)
 Read the response body data from the HTTP server The function handles both oneshot and chunked body responses. More...
 
int16_t HTTPClient_setHeader (HTTPClient_Handle client, uint32_t option, void *value, uint32_t len, uint32_t flags)
 Setting HTTP Client Header-field configurations. More...
 
int16_t HTTPClient_setHeaderByName (HTTPClient_Handle client, uint32_t option, const char *name, void *value, uint32_t len, uint32_t flags)
 Setting HTTP Client Header-field configurations by header name. Both standard (as defined by the HTTP RFC spec) and non-standard header names are supported. This API supports request and response headers. More...
 
int16_t HTTPClient_getHeader (HTTPClient_Handle client, uint32_t option, void *value, uint32_t *len, uint32_t flags)
 Getting HTTP Client Header-field configurations. More...
 
int16_t HTTPClient_getHeaderByName (HTTPClient_Handle client, uint32_t option, const char *name, void *value, uint32_t *len, uint32_t flags)
 Getting HTTP Client Header-field configurations. This API doesn't support removing existing custom header name, to do so please close the HTTPClient and reallocate it. This API for now, supports only custom 'response' headers. More...
 
int16_t HTTPClient_setOpt (HTTPClient_Handle client, uint32_t option, void *value, uint32_t len, uint32_t flags)
 Setting HTTP Client configurations. More...
 
int16_t HTTPClient_getOpt (HTTPClient_Handle client, uint32_t option, void *value, uint32_t *len, uint32_t flags)
 Getting HTTP Client configurations. More...
 
void HTTPClient_setProxy (const SlNetSock_Addr_t *addr)
 Uses the http CONNECT method to create a tunnel through a remote proxy server to the host designated in HTTPClient_connect. More...
 

Variables

const char * HTTP_METHOD_GET
 
const char * HTTP_METHOD_POST
 
const char * HTTP_METHOD_HEAD
 
const char * HTTP_METHOD_OPTIONS
 
const char * HTTP_METHOD_PUT
 
const char * HTTP_METHOD_DELETE
 
const char * HTTP_METHOD_CONNECT
 

Detailed Description

The HTTP client provides APIs to connect to, and communicate with, HTTP Servers.

Library Usage

To use the HTTPClient APIs, the application should include its header file as follows:

And, add the following HTTP library to the link line:

.../source/ti/net/http/{toolchain}/{isa}/httpclient_{profile}.a

Macro Definition Documentation

§ HTTPClient_DOMAIN_BUFLEN

#define HTTPClient_DOMAIN_BUFLEN   (100)

§ HTTPClient_RES_HFIELD_BUFFER_SIZE

#define HTTPClient_RES_HFIELD_BUFFER_SIZE   (300)

Size of the buffer which is used to store response values

§ HTTPClient_MIN_USER_WORKSPACE_SIZE

#define HTTPClient_MIN_USER_WORKSPACE_SIZE   (500)

Minimum workspace size user should alloc in order to create client handle

§ HTTPClient_MAX_REDIRECTION_ATTEMPTS

#define HTTPClient_MAX_REDIRECTION_ATTEMPTS   (3)

§ HTTPClient_MAX_REQUEST_ATTEMPTS

#define HTTPClient_MAX_REQUEST_ATTEMPTS   (2)

§ HTTPClient_MAX_RESPONSE_HEADER_FILEDS

#define HTTPClient_MAX_RESPONSE_HEADER_FILEDS   (25)

§ HTTPClient_PORT

#define HTTPClient_PORT   (80)

§ HTTPClient_SECURE_PORT

#define HTTPClient_SECURE_PORT   (443)

§ HTTPClient_HFIELD_RES_AGE

#define HTTPClient_HFIELD_RES_AGE   (0)

Age HTTP response header

The HTTP standard response header containing the string Age

§ HTTPClient_HFIELD_RES_ALLOW

#define HTTPClient_HFIELD_RES_ALLOW   (1)

Allow HTTP response header

The HTTP standard response header containing the string Allow

§ HTTPClient_HFIELD_RES_CACHE_CONTROL

#define HTTPClient_HFIELD_RES_CACHE_CONTROL   (2)

Cache-Control HTTP response header

The HTTP standard response header containing the string Cache-Control

§ HTTPClient_HFIELD_RES_CONNECTION

#define HTTPClient_HFIELD_RES_CONNECTION   (3)

Connection HTTP response header

The HTTP standard response header containing the string Connection

§ HTTPClient_HFIELD_RES_CONTENT_ENCODING

#define HTTPClient_HFIELD_RES_CONTENT_ENCODING   (4)

Content-Encoding HTTP response header

The HTTP standard response header containing the string Content-Encoding

§ HTTPClient_HFIELD_RES_CONTENT_LANGUAGE

#define HTTPClient_HFIELD_RES_CONTENT_LANGUAGE   (5)

Content-Language HTTP response header

The HTTP standard response header containing the string Content-Language

§ HTTPClient_HFIELD_RES_CONTENT_LENGTH

#define HTTPClient_HFIELD_RES_CONTENT_LENGTH   (6)

Content-Length HTTP response header

The HTTP standard response header containing the string Content-Length

§ HTTPClient_HFIELD_RES_CONTENT_LOCATION

#define HTTPClient_HFIELD_RES_CONTENT_LOCATION   (7)

Content-Location HTTP response header

The HTTP standard response header containing the string Content-Location

§ HTTPClient_HFIELD_RES_CONTENT_RANGE

#define HTTPClient_HFIELD_RES_CONTENT_RANGE   (8)

Content-Range HTTP response header

The HTTP standard response header containing the string Content-Range

§ HTTPClient_HFIELD_RES_CONTENT_TYPE

#define HTTPClient_HFIELD_RES_CONTENT_TYPE   (9)

Content-Type HTTP response header

The HTTP standard response header containing the string Content-Type

§ HTTPClient_HFIELD_RES_DATE

#define HTTPClient_HFIELD_RES_DATE   (10)

Date HTTP response header

The HTTP standard response header containing the string Date

§ HTTPClient_HFIELD_RES_ETAG

#define HTTPClient_HFIELD_RES_ETAG   (11)

ETag HTTP response header

The HTTP standard response header containing the string ETag

§ HTTPClient_HFIELD_RES_EXPIRES

#define HTTPClient_HFIELD_RES_EXPIRES   (12)

Expires HTTP response header

The HTTP standard response header containing the string Expires

§ HTTPClient_HFIELD_RES_LAST_MODIFIED

#define HTTPClient_HFIELD_RES_LAST_MODIFIED   (13)

Last-Modified HTTP response header

The HTTP standard response header containing the string Last-Modified

§ HTTPClient_HFIELD_RES_LOCATION

#define HTTPClient_HFIELD_RES_LOCATION   (14)

Location HTTP response header

The HTTP standard response header containing the string Location

§ HTTPClient_HFIELD_RES_PROXY_AUTHENTICATE

#define HTTPClient_HFIELD_RES_PROXY_AUTHENTICATE   (15)

Proxy-Authenticate HTTP response header

The HTTP standard response header containing the string Proxy-Authenticate

§ HTTPClient_HFIELD_RES_RETRY_AFTER

#define HTTPClient_HFIELD_RES_RETRY_AFTER   (16)

Retry-After HTTP response header

The HTTP standard response header containing the string Retry-After

§ HTTPClient_HFIELD_RES_SERVER

#define HTTPClient_HFIELD_RES_SERVER   (17)

Server HTTP response header

The HTTP standard response header containing the string Server

§ HTTPClient_HFIELD_RES_SET_COOKIE

#define HTTPClient_HFIELD_RES_SET_COOKIE   (18)

Set-Cookie HTTP response header

The HTTP standard response header containing the string Set-Cookie

§ HTTPClient_HFIELD_RES_TRAILER

#define HTTPClient_HFIELD_RES_TRAILER   (19)

Trailer HTTP response header

The HTTP standard response header containing the string Trailer

§ HTTPClient_HFIELD_RES_TRANSFER_ENCODING

#define HTTPClient_HFIELD_RES_TRANSFER_ENCODING   (20)

Transfer-Encoding HTTP response header

The HTTP standard response header containing the string Transfer-Encoding

§ HTTPClient_HFIELD_RES_UPGRADE

#define HTTPClient_HFIELD_RES_UPGRADE   (21)

Upgrade HTTP response header

The HTTP standard response header containing the string Upgrade

§ HTTPClient_HFIELD_RES_VARY

#define HTTPClient_HFIELD_RES_VARY   (22)

Vary HTTP response header

The HTTP standard response header containing the string Vary

§ HTTPClient_HFIELD_RES_VIA

#define HTTPClient_HFIELD_RES_VIA   (23)

Via HTTP response header

The HTTP standard response header containing the string Via

§ HTTPClient_HFIELD_RES_WWW_AUTHENTICATE

#define HTTPClient_HFIELD_RES_WWW_AUTHENTICATE   (24)

Www-Authenticate HTTP response header

The HTTP standard response header containing the string Www-Authenticate

§ HTTPClient_HFIELD_RES_WARNING

#define HTTPClient_HFIELD_RES_WARNING   (25)

Warning HTTP response header

The HTTP standard response header containing the string Warning

§ HTTPClient_REQUEST_HEADER_MASK

#define HTTPClient_REQUEST_HEADER_MASK   (0x80000000)

§ HTTPClient_HFIELD_REQ_ACCEPT

#define HTTPClient_HFIELD_REQ_ACCEPT   (26 | HTTPClient_REQUEST_HEADER_MASK)

Accept HTTP request header

The HTTP standard request header containing the string Accept

§ HTTPClient_HFIELD_REQ_ACCEPT_CHARSET

#define HTTPClient_HFIELD_REQ_ACCEPT_CHARSET   (27 | HTTPClient_REQUEST_HEADER_MASK)

Accept-Charset HTTP request header

The HTTP standard request header containing the string Accept-Charset

§ HTTPClient_HFIELD_REQ_ACCEPT_ENCODING

#define HTTPClient_HFIELD_REQ_ACCEPT_ENCODING   (28 | HTTPClient_REQUEST_HEADER_MASK)

Accept-Encoding HTTP request header

The HTTP standard request header containing the string Accept-Encoding

§ HTTPClient_HFIELD_REQ_ACCEPT_LANGUAGE

#define HTTPClient_HFIELD_REQ_ACCEPT_LANGUAGE   (29 | HTTPClient_REQUEST_HEADER_MASK)

Accept-Language HTTP request header

The HTTP standard request header containing the string Accept-Language

§ HTTPClient_HFIELD_REQ_ALLOW

#define HTTPClient_HFIELD_REQ_ALLOW   (HTTPClient_HFIELD_RES_ALLOW | HTTPClient_REQUEST_HEADER_MASK)

Allow HTTP request header

The HTTP standard request header containing the string Allow

§ HTTPClient_HFIELD_REQ_AUTHORIZATION

#define HTTPClient_HFIELD_REQ_AUTHORIZATION   (30 | HTTPClient_REQUEST_HEADER_MASK)

Authorization HTTP request header

The HTTP standard request header containing the string Authorization

§ HTTPClient_HFIELD_REQ_CACHE_CONTROL

#define HTTPClient_HFIELD_REQ_CACHE_CONTROL   (HTTPClient_HFIELD_RES_CACHE_CONTROL | HTTPClient_REQUEST_HEADER_MASK)

Cache-Control HTTP request header

The HTTP standard request header containing the string Cache-Control

§ HTTPClient_HFIELD_REQ_CONNECTION

#define HTTPClient_HFIELD_REQ_CONNECTION   (HTTPClient_HFIELD_RES_CONNECTION | HTTPClient_REQUEST_HEADER_MASK)

Connection HTTP request header

The HTTP standard request header containing the string Connection

§ HTTPClient_HFIELD_REQ_CONTENT_ENCODING

#define HTTPClient_HFIELD_REQ_CONTENT_ENCODING   (HTTPClient_HFIELD_RES_CONTENT_ENCODING | HTTPClient_REQUEST_HEADER_MASK)

Content-Encoding HTTP request header

The HTTP standard request header containing the string Content-Encoding

§ HTTPClient_HFIELD_REQ_CONTENT_LANGUAGE

#define HTTPClient_HFIELD_REQ_CONTENT_LANGUAGE   (HTTPClient_HFIELD_RES_CONTENT_LANGUAGE | HTTPClient_REQUEST_HEADER_MASK)

Content-Language HTTP request header

The HTTP standard request header containing the string Content-Language

§ HTTPClient_HFIELD_REQ_CONTENT_LOCATION

#define HTTPClient_HFIELD_REQ_CONTENT_LOCATION   (HTTPClient_HFIELD_RES_CONTENT_LOCATION | HTTPClient_REQUEST_HEADER_MASK)

Location HTTP request header

The HTTP standard request header containing the string Location

§ HTTPClient_HFIELD_REQ_CONTENT_TYPE

#define HTTPClient_HFIELD_REQ_CONTENT_TYPE   (HTTPClient_HFIELD_RES_CONTENT_TYPE | HTTPClient_REQUEST_HEADER_MASK)

Content-Type HTTP request header

The HTTP standard request header containing the string Content-Type

§ HTTPClient_HFIELD_REQ_COOKIE

#define HTTPClient_HFIELD_REQ_COOKIE   (31 | HTTPClient_REQUEST_HEADER_MASK)

Cookie HTTP request header

The HTTP standard request header containing the string Cookie

§ HTTPClient_HFIELD_REQ_DATE

#define HTTPClient_HFIELD_REQ_DATE   (HTTPClient_HFIELD_RES_DATE | HTTPClient_REQUEST_HEADER_MASK)

Date HTTP request header

The HTTP standard request header containing the string Date

§ HTTPClient_HFIELD_REQ_EXPECT

#define HTTPClient_HFIELD_REQ_EXPECT   (32 | HTTPClient_REQUEST_HEADER_MASK)

Expect HTTP request header

The HTTP standard request header containing the string Expect

§ HTTPClient_HFIELD_REQ_FORWARDED

#define HTTPClient_HFIELD_REQ_FORWARDED   (33 | HTTPClient_REQUEST_HEADER_MASK)

Forwarded HTTP request header

The HTTP standard request header containing the string Forwarded

§ HTTPClient_HFIELD_REQ_FROM

#define HTTPClient_HFIELD_REQ_FROM   (34 | HTTPClient_REQUEST_HEADER_MASK)

From HTTP request header

The HTTP standard request header containing the string From

§ HTTPClient_HFIELD_REQ_HOST

#define HTTPClient_HFIELD_REQ_HOST   (35 | HTTPClient_REQUEST_HEADER_MASK)

Host HTTP request header

The HTTP standard request header containing the string Host

§ HTTPClient_HFIELD_REQ_IF_MATCH

#define HTTPClient_HFIELD_REQ_IF_MATCH   (36 | HTTPClient_REQUEST_HEADER_MASK)

If-Match HTTP request header

The HTTP standard request header containing the string If-Match

§ HTTPClient_HFIELD_REQ_IF_MODIFIED_SINCE

#define HTTPClient_HFIELD_REQ_IF_MODIFIED_SINCE   (37 | HTTPClient_REQUEST_HEADER_MASK)

If-Modified-Since HTTP request header

The HTTP standard request header containing the string If-Modified-Since

§ HTTPClient_HFIELD_REQ_IF_NONE_MATCH

#define HTTPClient_HFIELD_REQ_IF_NONE_MATCH   (38 | HTTPClient_REQUEST_HEADER_MASK)

If-None-Match HTTP request header

The HTTP standard request header containing the string If-None-Match

§ HTTPClient_HFIELD_REQ_IF_RANGE

#define HTTPClient_HFIELD_REQ_IF_RANGE   (39 | HTTPClient_REQUEST_HEADER_MASK)

If-Range HTTP request header

The HTTP standard request header containing the string If-Range

§ HTTPClient_HFIELD_REQ_IF_UNMODIFIED_SINCE

#define HTTPClient_HFIELD_REQ_IF_UNMODIFIED_SINCE   (40 | HTTPClient_REQUEST_HEADER_MASK)

If-Unmodified-Since HTTP request header

The HTTP standard request header containing the string If-Unmodified-Since

§ HTTPClient_HFIELD_REQ_ORIGIN

#define HTTPClient_HFIELD_REQ_ORIGIN   (41 | HTTPClient_REQUEST_HEADER_MASK)

Origin HTTP request header

The HTTP standard request header containing the string Origin

§ HTTPClient_HFIELD_REQ_PROXY_AUTHORIZATION

#define HTTPClient_HFIELD_REQ_PROXY_AUTHORIZATION   (42 | HTTPClient_REQUEST_HEADER_MASK)

Proxy-Authorization HTTP request header

The HTTP standard request header containing the string Proxy-Authorization

§ HTTPClient_HFIELD_REQ_RANGE

#define HTTPClient_HFIELD_REQ_RANGE   (43 | HTTPClient_REQUEST_HEADER_MASK)

Range HTTP request header

The HTTP standard request header containing the string Range

§ HTTPClient_HFIELD_REQ_TE

#define HTTPClient_HFIELD_REQ_TE   (44 | HTTPClient_REQUEST_HEADER_MASK)

TE HTTP request header

The HTTP standard request header containing the string TE

§ HTTPClient_HFIELD_REQ_TRANSFER_ENCODING

#define HTTPClient_HFIELD_REQ_TRANSFER_ENCODING   (HTTPClient_HFIELD_RES_TRANSFER_ENCODING | HTTPClient_REQUEST_HEADER_MASK)

Transfer-Encoding HTTP request header

The HTTP standard request header containing the string Transfer-Encoding

§ HTTPClient_HFIELD_REQ_UPGRADE

#define HTTPClient_HFIELD_REQ_UPGRADE   (HTTPClient_HFIELD_RES_UPGRADE | HTTPClient_REQUEST_HEADER_MASK)

Upgrade HTTP request header

The HTTP standard request header containing the string Upgrade

§ HTTPClient_HFIELD_REQ_USER_AGENT

#define HTTPClient_HFIELD_REQ_USER_AGENT   (45 | HTTPClient_REQUEST_HEADER_MASK)

User-Agent HTTP request header

The HTTP standard request header containing the string User-Agent

§ HTTPClient_HFIELD_REQ_VIA

#define HTTPClient_HFIELD_REQ_VIA   (HTTPClient_HFIELD_RES_VIA | HTTPClient_REQUEST_HEADER_MASK)

Via HTTP request header

The HTTP standard request header containing the string Via

§ HTTPClient_HFIELD_REQ_WARNING

#define HTTPClient_HFIELD_REQ_WARNING   (HTTPClient_HFIELD_RES_WARNING | HTTPClient_REQUEST_HEADER_MASK)

Warning HTTP request header

The HTTP standard request header containing the string Warning

§ HTTPClient_MAX_NUMBER_OF_HEADER_FIELDS

#define HTTPClient_MAX_NUMBER_OF_HEADER_FIELDS   (46)

§ HTTPClient_REDIRECT_FEATURE

#define HTTPClient_REDIRECT_FEATURE   (48)

Enable / Disable redirect feature

§ HTTPClient_RESPONSE_FILTER_CLEAR

#define HTTPClient_RESPONSE_FILTER_CLEAR   (49)

Clear response filter to default(all enabled)

§ HTTPClient_REDIRECT_TLS_DOWNGRADE

#define HTTPClient_REDIRECT_TLS_DOWNGRADE   (50)

Enable / Disable the option for tls downgrade

§ HTTPClient_AUTHENTICATE_SERVER_CALLBACK

#define HTTPClient_AUTHENTICATE_SERVER_CALLBACK   (51)

Attaches callback which will handle the server authentication response (401)

§ HTTPClient_ESENDBUFSMALL

#define HTTPClient_ESENDBUFSMALL   (-3001)

Internal send buffer is not big enough.

Define HTTPClient_BUF_LEN in httpclient_internal.h and rebuild the library.

§ HTTPClient_EGETOPTBUFSMALL

#define HTTPClient_EGETOPTBUFSMALL   (-3002)

Buffer inserted into HTTPClient_getOpt() is not big enough.

§ HTTPClient_ERESPONSEINVALID

#define HTTPClient_ERESPONSEINVALID   (-3003)

Response received from the server is not a valid HTTP/1.1 or HTTP/1.0 response.

§ HTTPClient_EINPROGRESS

#define HTTPClient_EINPROGRESS   (-3004)

Operation could not be completed. Try again.

§ HTTPClient_EDOMAINBUFSMALL

#define HTTPClient_EDOMAINBUFSMALL   (-3005)

Input domain name length is too long to be read into buffer.

Modify the HTTPClient_DOMAIN_BUFLEN and rebuild the library.

See also
HTTPClient_DOMAIN_BUFLEN

§ HTTPClient_ECBALLOCATIONFAILED

#define HTTPClient_ECBALLOCATIONFAILED   (-3006)

Allocation failed during the CB creation.

Check whether there is free memory for CB allocation.

§ HTTPClient_EBODYBUFSMALL

#define HTTPClient_EBODYBUFSMALL   (-3008)

Body size is too small.

Body which was entered into the request was too small, This error won't occur if the body size will be at least HTTPClient_BUF_LEN.

§ HTTPClient_ENULLPOINTER

#define HTTPClient_ENULLPOINTER   (-3009)

Invalid de-referencing a NULL pointer.

Check that a NULL pointer wasn't dereferenced in the function.

§ HTTPClient_EREQUESTHEADERALLOCFAILED

#define HTTPClient_EREQUESTHEADERALLOCFAILED   (-3010)

Request header allocation failed.

§ HTTPClient_EREQHEADERNOTFOUND

#define HTTPClient_EREQHEADERNOTFOUND   (-3011)

Request header wasn't found in the req header list.

§ HTTPClient_EHOSTNOTFOUND

#define HTTPClient_EHOSTNOTFOUND   (-3012)

Host request header wasn't found.

Host header-field is mandatory.

§ HTTPClient_ECLIENTALREADYCONNECTED

#define HTTPClient_ECLIENTALREADYCONNECTED   (-3013)

Client is already connected.

§ HTTPClient_ERESPONSEISNOTREDIRECTABLE

#define HTTPClient_ERESPONSEISNOTREDIRECTABLE   (-3014)

Response is not redirectable.

§ HTTPClient_ESENDERROR

#define HTTPClient_ESENDERROR   (-3015)

Send couldn't be completed.

§ HTTPClient_EREDIRECTLOCATIONFAIL

#define HTTPClient_EREDIRECTLOCATIONFAIL   (-3016)

Location Header fields value couldn't be read completely.

Since the "Location" header-field is essential for the redirect mechanism it is imposible to complete the redirect without it. This error indicates that the buffer for the Location header field value was too small. Enlarge HTTPClient_BUF_LEN in order to fix this error, or disable the redirect mechanism.

§ HTTPClient_ETLSDOWNGRADEISFORBIDDEN

#define HTTPClient_ETLSDOWNGRADEISFORBIDDEN   (-3017)

TLS downgrade is forbidden.

This error indicates that after redirect occured, the server asked the client to redirect from secured server into non-secured server. This option is forbidden by default, to enable use HTTPClient_setOpt()

§ HTTPClient_EWRONGAPIPARAMETER

#define HTTPClient_EWRONGAPIPARAMETER   (-3018)

Wrong API parameter.

Wrong parameter entered into the API.

§ HTTPClient_EHOSTHEADERALREADYEXIST

#define HTTPClient_EHOSTHEADERALREADYEXIST   (-3019)

HOST already exist.

Host header is already exist, having multiple Host headers is invalid. Remove the existing host Header.

§ HTTPClient_ENOCONNECTION

#define HTTPClient_ENOCONNECTION   (-3020)

Client is disconnected.

SlNetSock_recv return 0 which means the client is disconnected.

§ HTTPClient_ENOTABSOLUTEURI

#define HTTPClient_ENOTABSOLUTEURI   (-3021)

URI is not absolute.

When Host header is not found, reconnection can be established only with absolute URI.

§ HTTPClient_ECANTCREATESECATTRIB

#define HTTPClient_ECANTCREATESECATTRIB   (-3022)

Error during creation of security attribute.

Error occured during the creationg of security attribue

§ HTTPClient_EINTERNAL

#define HTTPClient_EINTERNAL   (-3023)

General internal error.

Error occured during processing in the HTTP Client library

§ HTTPClient_EGETCUSOMHEADERBUFSMALL

#define HTTPClient_EGETCUSOMHEADERBUFSMALL   (-3024)

Buffer inserted into HTTPClient_getHeaderByName(..) is not big enough.

§ HTTPClient_ENOHEADERNAMEDASINSERTED

#define HTTPClient_ENOHEADERNAMEDASINSERTED   (-3025)

Custom response header name on HTTPClient_getHeaderByName(..) dosn't set before.

§ HTTPClient_IGNORE_PROXY

#define HTTPClient_IGNORE_PROXY   (0x01)

If proxy is set, this flag makes the connection without the proxy

§ HTTPClient_HOST_EXIST

#define HTTPClient_HOST_EXIST   (0x02)

If the user already added "Host:" header, set this flag

§ HTTPClient_HFIELD_NOT_PERSISTENT

#define HTTPClient_HFIELD_NOT_PERSISTENT   (0x01)

Header Field added is not persistent

§ HTTPClient_HFIELD_PERSISTENT

#define HTTPClient_HFIELD_PERSISTENT   (0x02)

Header Field added is persistent

§ HTTPClient_CUSTOM_RESPONSE_HEADER

#define HTTPClient_CUSTOM_RESPONSE_HEADER   (0x01)

Header Field for add or remove custom response header on setHeaderByName

§ HTTPClient_CHUNK_START

#define HTTPClient_CHUNK_START   (0x01)

Header field indicate of remove requested name header Sets the client's request state into chunked body

§ HTTPClient_CHUNK_END

#define HTTPClient_CHUNK_END   (0x02)

Sets the client's request state out of chunked body and sends last chunk

§ HTTPClient_DROP_BODY

#define HTTPClient_DROP_BODY   (0x04)

Flushes the response body

Typedef Documentation

§ HTTPClient_extSecParams

§ HTTPClient_authenticationCallback

typedef int16_t(* HTTPClient_authenticationCallback) (const char *serverAuthBuff, uint32_t serverAuthLen, char *clientAuthBuff, uint32_t *clientAuthLen)

HTTPClient callback for server authentication handling This function is responsible for generating the value for the authorization request header.

Parameters
[in]serverAuthBuffBuffer containing authentication information (Www-Authenticate response header) received from server.
[in]serverAuthLenServer authentication buffer length.
[out]clientAuthBuffBuffer containing Authorization request header.
[in,out]clientAuthLenInput is the maximum size of the client Authorization request header buffer (HTTPClient_BUF_LEN), Output is the actual size of the client Authorization request header buffer.
Returns
0 on success or error code on failure.

§ HTTPClient_Handle

typedef void* HTTPClient_Handle

Function Documentation

§ HTTPClient_create()

HTTPClient_Handle HTTPClient_create ( int16_t *  status,
void *  params 
)

Allocate and initialize a new HTTPClient instance object and return its handle.

Parameters
[out]statuspointer to return status
[in]paramsSpecial parameters for creating the instance (currently there are no special parameters)
Returns
handle on success or NULL failure.

§ HTTPClient_destroy()

int16_t HTTPClient_destroy ( HTTPClient_Handle  client)

Destroy the HTTP client instance and free the previously allocated instance object.

Parameters
[in]clientPointer to the HTTP client instance
Returns
0 on success or error code on failure.

§ HTTPClient_connect2()

int16_t HTTPClient_connect2 ( HTTPClient_Handle  client,
const char *  hostName,
SlNetSockSecAttrib_t secAttribs,
uint32_t  flags,
int16_t *  secureRetVal 
)

Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both. HTTPClient_connect2 allows the user more control over security by accepting a secure attribute object and returning the value of the attempted secure connection.

Parameters
[in]clientInstance of an HTTP client
[in]hostNameIP address or URL of the HTTP server.
[in]secAttribsA secure attributes object for configuring security.
[in]flagsSpecial flags for connection:
[out]secureRetValOptional - If an error occurred while establishing a secure connection, the error code will be contained here. NULL should be passed if this is not desired.
Returns
0 on success or error code on failure.
See also
HTTPClient_connect()

§ HTTPClient_connect()

int16_t HTTPClient_connect ( HTTPClient_Handle  client,
const char *  hostName,
HTTPClient_extSecParams exSecParams,
uint32_t  flags 
)

Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both.

Parameters
[in]clientInstance of an HTTP client
[in]hostNameIP address or URL of the HTTP server.
[in]exSecParamsOptional - External parameters for configuring security.
[in]flagsSpecial flags for connection:
Returns
0 on success or error code on failure.
See also
HTTPClient_connect2()

§ HTTPClient_disconnect()

int16_t HTTPClient_disconnect ( HTTPClient_Handle  client)

Disconnect from the HTTP server.

Parameters
[in]clientInstance of the HTTP client
Returns
0 on success or error code on failure.

§ HTTPClient_sendRequest()

int16_t HTTPClient_sendRequest ( HTTPClient_Handle  client,
const char *  method,
const char *  requestURI,
const char *  body,
uint32_t  bodyLen,
uint32_t  flags 
)

Make an HTTP request to the HTTP server.

Sends an HTTP request-line, header fields and body to the requested URI. After sending the request, the request function waits for the response Status and Header-Fields. According to the response status, the request function determines whether to return to user or to call a redirect/callback pre-defined function.

Parameters
[in]clientInstance of an HTTP client.
[in]methodHTTP method.
[in]requestURIThe path on the server to open.
[in]bodyThe body the user wishes to send in in the request, The body can be chunked or one body buffer.
[in]bodyLenLength of the body sent in the request.
[in]flagsSpecial flags when the user wishes not to use the default settings.
Note
- If user wishes to use TLS connection then before calling HTTPClient_sendRequest(), HTTPClient_connect() should be called.
  • If disconnection happened prior to HTTPClient_sendRequest(), HTTPClient_sendRequest() will reconnect internally.
  • When sending a body in a request, the "Content-length: " and "Transfer-Encoding: Chunked" headers will be added automatically.
Returns
Response status code on success or error code on failure.

§ HTTPClient_readResponseBody()

int16_t HTTPClient_readResponseBody ( HTTPClient_Handle  client,
char *  body,
uint32_t  bodyLen,
bool *  moreDataFlag 
)

Read the response body data from the HTTP server The function handles both oneshot and chunked body responses.

Make a call to this function only after the call to HTTPClient_sendRequest().

Parameters
[in]clientInstance of an HTTP client
[out]bodyResponse body buffer
[in]bodyLenLength of response body buffer
[out]moreDataFlagSet if more data is available
Note
Make a call to this function only after the call to HTTPClient_sendRequest(). This function need to be called until moreDataFlag will be false(All data was read).
Returns
The number of characters read on success or error code on failure

§ HTTPClient_setHeader()

int16_t HTTPClient_setHeader ( HTTPClient_Handle  client,
uint32_t  option,
void *  value,
uint32_t  len,
uint32_t  flags 
)

Setting HTTP Client Header-field configurations.

Parameters
[in]clientInstance of an HTTP client
[in]optionOptions for setting could be one of the following: -Header-Fields ID - Request - headers - sets the headers-fields which will be used in requests. Response - headers - sets the headers-fields wanted to be un-filtered in a response. (if no request headers are set, all the headers will be available with size constraints)
[in]valueValue for setting could be any related value for the corresponding option. Value can be set to NULL when request header wanted to be removed.
[in]lenLength of the value.
[in]flagsFlags for settings need be one of the following:
Returns
0 on success or error code on failure.

§ HTTPClient_setHeaderByName()

int16_t HTTPClient_setHeaderByName ( HTTPClient_Handle  client,
uint32_t  option,
const char *  name,
void *  value,
uint32_t  len,
uint32_t  flags 
)

Setting HTTP Client Header-field configurations by header name. Both standard (as defined by the HTTP RFC spec) and non-standard header names are supported. This API supports request and response headers.

When a given standard HTTP header is set, it is important to consistently set it using one of HTTPClient_setHeaderByName() or HTTPClient_setHeader(). The ordering of the values may not be preserved if both APIs are used to set the same header.

Parameters
[in]clientInstance of an HTTP client
[in]optionOptions for setting could be one of the following: HTTPClient_REQUEST_HEADER_MASK - sets a header-field which will be used in requests. HTTPClient_CUSTOM_RESPONSE_HEADER - sets a header-field which will be used when HTTP response retrieve. This option need to be used when the user want to store custom response header by name.
[in]nameName of header. Must be NULL-terminated.
[in]valueOn request - Value for setting could be any related value for the corresponding header. On response - Must be NULL.
[in]lenOn request - Length of the value. On response - Must be 0.
[in]flagsOn request - Flags for settings need be one of the following:
  • HTTPClient_HFIELD_NOT_PERSISTENT - Header-Field is not persistent.
  • HTTPClient_HFIELD_PERSISTENT - Header-Field is persistent. On response - Flags should be 0. Currently, HTTP custom response header only supports persistent mode. No option right now, to set a custom response header for single request and clear it after the first response, not by sign it as non-persistent and not by clear it after one use. For clear custom response header after set only close the HTTPClient connection by "HTTPClient_destroy", and open a new one.
Returns
0 on success or error code on failure.

§ HTTPClient_getHeader()

int16_t HTTPClient_getHeader ( HTTPClient_Handle  client,
uint32_t  option,
void *  value,
uint32_t *  len,
uint32_t  flags 
)

Getting HTTP Client Header-field configurations.

Parameters
[in]clientInstance of an HTTP client
[in]optionOptions for getting could be one of the following: -Header-Fields ID -Response - headers - getting response headers-field value (only if value was set previously, and asked to be stored using another HTTPClient API).
[out]valueValue for getting, could be any related value for the corresponding option.
[in,out]lenInputs Length of the value and output the actual length.
[in]flagsFlags for getting special configurations.
Returns
0 on success or error code on failure.

§ HTTPClient_getHeaderByName()

int16_t HTTPClient_getHeaderByName ( HTTPClient_Handle  client,
uint32_t  option,
const char *  name,
void *  value,
uint32_t *  len,
uint32_t  flags 
)

Getting HTTP Client Header-field configurations. This API doesn't support removing existing custom header name, to do so please close the HTTPClient and reallocate it. This API for now, supports only custom 'response' headers.

Parameters
[in]clientInstance of an HTTP client. 'client' - cannot be NULL.
[in]optionOptions for getting could be one of the following:
                    -Response - headers - getting custom response headers-field value (only if value was set previously and asked to be stored using HTTPClient_setHeaderByName).
                    #HTTPClient_CUSTOM_RESPONSE_HEADER
[in]nameShould contain the requested custom response header name for retrieve the appropriate value stored on the last HTTP response. 'name' cannot be NULL.
[out]valuePointer value for store the appropriate value on the last HTTP response respectively to requested 'name' - will be copied into the pointer. 'value' cannot be NULL.
[in,out]lenInputs Length of the value buffer size and output the actual inserted custom response header value length. 'len' cannot be 0.
[in]flagsFlags for getting special configurations - right now not in use.
Returns
0 on success or error code on failure.

§ HTTPClient_setOpt()

int16_t HTTPClient_setOpt ( HTTPClient_Handle  client,
uint32_t  option,
void *  value,
uint32_t  len,
uint32_t  flags 
)

Setting HTTP Client configurations.

Parameters
[in]clientInstance of an HTTP client
[in]optionOptions for setting could be one of the following: -Client instance parameters:
[in]valueValue for setting could be any related value for the corresponding option.
[in]lenLength of the value.
[in]flagsFlags for settings special configurations.
Returns
0 on success or error code on failure.

§ HTTPClient_getOpt()

int16_t HTTPClient_getOpt ( HTTPClient_Handle  client,
uint32_t  option,
void *  value,
uint32_t *  len,
uint32_t  flags 
)

Getting HTTP Client configurations.

Parameters
[in]clientInstance of an HTTP client
[in]optionOptions for getting client settings.
[out]valueValue for getting, could be any related value for the corresponding option.
[in,out]lenInputs Length of the value and output the actual length.
[in]flagsFlags for getting special configurations
Note
Currently there are no client configurations to get.
Returns
0 on success or error code on failure.

§ HTTPClient_setProxy()

void HTTPClient_setProxy ( const SlNetSock_Addr_t addr)

Uses the http CONNECT method to create a tunnel through a remote proxy server to the host designated in HTTPClient_connect.

Parameters
[in]addrPointer to SlNetSock_Addr_t struct containing ip and port number of proxy server
Returns
none
uint32_t ipAddress;
uint16_t portNumber = ####; //Proxy server port
char strip[] = "###.###.###.###"; //Proxy server address
SlNetUtil_inetPton(SLNETSOCK_AF_INET, strip, &ipAddress); //Function transform address string into binary
sAddr.sin_port = SlNetUtil_htons((unsigned short)portNumber);
sAddr.sin_addr.s_addr = (unsigned int)ipAddress;
sa = (SlNetSock_Addr_t*)&sAddr; //HTTPClient_setProxy() expects a SlNetSock_Addr_t, but the input
//is treated like a SlNetSock_AddrIn_t when the socket is created

Variable Documentation

§ HTTP_METHOD_GET

const char* HTTP_METHOD_GET

§ HTTP_METHOD_POST

const char* HTTP_METHOD_POST

§ HTTP_METHOD_HEAD

const char* HTTP_METHOD_HEAD

§ HTTP_METHOD_OPTIONS

const char* HTTP_METHOD_OPTIONS

§ HTTP_METHOD_PUT

const char* HTTP_METHOD_PUT

§ HTTP_METHOD_DELETE

const char* HTTP_METHOD_DELETE

§ HTTP_METHOD_CONNECT

const char* HTTP_METHOD_CONNECT
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale