diff --git a/include/netutils/webclient.h b/include/netutils/webclient.h index 560f04cb5..1d69f71c1 100644 --- a/include/netutils/webclient.h +++ b/include/netutils/webclient.h @@ -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) diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index 570f62292..df1cd8f62 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -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);