HTTPc_ReqSend
Sends a HTTP Request to a remote HTTP server.
Files
http-c.h/http-c.c
Prototype
CPU_BOOLEAN HTTPc_ConnOpen (HTTPc_CONN_OBJ *p_conn_obj, HTTPc_REQ_OBJ *p_req_obj, HTTPc_RESP_OBJ *p_resp_obj, HTTP_METHOD method, CPU_CHAR *p_resource_path, CPU_INT16U resource_path_len, HTTPc_FLAGS flags, HTTPc_ERR *p_err);
Arguments
p_conn_obj
Pointer to the HTTPc Connection object on which to send HTTP request.
p_req_obj
Pointer to the HTTP Request object to send.
p_resp_obj
Pointer to the HTTPc Response object that will be filled with the HTTP response received from the server.
method
HTTP method's type of the request:
HTTP_METHOD_GET
HTTP_METHOD_POST
HTTP_METHOD_HEAD
HTTP_METHOD_PUT
HTTP_METHOD_DELETE
HTTP_METHOD_TRACE
HTTP_METHOD_CONNECT
HTTP_METHOD_OPTIONS
p_resource_path
Pointer to complete URI (or only resource path) string of the request.
resource_path_len
URI (or Resource path) string length.
flags
Configuration flags:
HTTPc_FLAG_REQ_NO_BLOCK
p_err
Pointer to variable that will receive the return error code from this function:
HTTPc_ERR_NONE
HTTPc_ERR_NULL_PTR
HTTPc_ERR_INIT_NOT_COMPLETED
HTTPc_ERR_CONN_IS_RELEASED
HTTPc_ERR_REQ_IS_USED
HTTPc_ERR_REQ_PARAM_METHOD_INVALID
HTTPc_ERR_REQ_PARAM_RESOURCE_PATH_INVALIDHTTPc_ERR_FEATURE_DIS
...
Returned Values
None.
Required Configuration
None.
Notes / Warnings
- This function MUST be called after the µC/HTTP-client Suite Initialization has been completed.
- If the µC/HTTP-client Asynchronous Task is enabled (
HTTPc_CFG_MODE_ASYNC_TASK_EN
macro in http-c_cfg.h), the HTTPc Request Object will be added to the request's queue. - If the
HTTPc_FLAG_REQ_NO_BLOCK
flag is set, the function will be in non-blocking mode. Therefore, the function could return before the HTTP transaction is finished. For the application to be notified when the HTTP transaction completes, the callback function must have been setup before with the parameter typeHTTPc_PARAM_TYPE_TRANS_COMPLETE_CALLBACK
.