webclient: Add a parameter to specifiy protocol version
This commit is contained in:
parent
81b9be5d2e
commit
3759da3d00
@ -307,6 +307,7 @@ struct webclient_context
|
||||
{
|
||||
/* request parameters
|
||||
*
|
||||
* protocol_version - HTTP protocol version. HTTP 1.0 by default.
|
||||
* method - HTTP method like "GET", "POST".
|
||||
* The default value is "GET".
|
||||
* url - A pointer to a string containing the full URL.
|
||||
@ -325,6 +326,12 @@ struct webclient_context
|
||||
* 10 seconds by default.
|
||||
*/
|
||||
|
||||
enum webclient_protocol_version_e
|
||||
{
|
||||
WEBCLIENT_PROTOCOL_VERSION_HTTP_1_0, /* HTTP 1.0 */
|
||||
WEBCLIENT_PROTOCOL_VERSION_HTTP_1_1, /* HTTP 1.1 */
|
||||
} protocol_version;
|
||||
|
||||
FAR const char *method;
|
||||
FAR const char *url;
|
||||
#if defined(CONFIG_WEBCLIENT_NET_LOCAL)
|
||||
|
@ -1625,6 +1625,7 @@ int wget_post(FAR const char *url, FAR const char *posts, FAR char *buffer,
|
||||
void webclient_set_defaults(FAR struct webclient_context *ctx)
|
||||
{
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
ctx->protocol_version = WEBCLIENT_PROTOCOL_VERSION_HTTP_1_0;
|
||||
ctx->method = "GET";
|
||||
ctx->timeout_sec = CONFIG_WEBCLIENT_TIMEOUT;
|
||||
_SET_STATE(ctx, WEBCLIENT_CONTEXT_STATE_INITIALIZED);
|
||||
|
Loading…
x
Reference in New Issue
Block a user