Commit Graph

51 Commits

Author SHA1 Message Date
Shubham Kulkarni 22926742be esp_http_client.c: In esp_http_client_read, add fix to return (-1) if esp_transport_read fails 2020-07-08 10:00:48 +05:30
Shubham Kulkarni a63b5d155f Bugfix for failing OTA example
example_test.py is added to test advanced_https_ota_example and native ota_example.

Closes https://github.com/espressif/esp-idf/issues/4394
2020-01-13 17:39:01 +05:30
Mahavir Jain 3063679f5a esp_http_client: fix issue where http parser was not invoking `message_complete` callback
https://github.com/espressif/esp-idf/issues/2625
https://github.com/espressif/esp-idf/issues/4209
2019-12-31 11:14:18 +05:30
Hrudaynath Dhabe 012ff5775b esp_http_client: Add support to check the binary length of the recieved stream and compare it with the size mentioned in the header.
While downloading OTA firmware, if their is a Origin Respnse Timeout or the binary is only partially downloaded, OTA failure is observed. Checking binary size can also be helpful for simple http client applications.

Closes https://github.com/espressif/esp-idf/issues/3004
2019-12-31 11:14:18 +05:30
David Cermak 40d5f61c4d http_client: added comments to http header generation function 2019-11-19 14:07:38 +00:00
David Cermak b7a9f5e115 http_client: possible buffer overflow fixed when determining last header item to be written
closes IDF-694
2019-11-19 14:07:38 +00:00
Jiang Jiang Jian 4e27cbb89f Merge branch 'feature/esp_https_ota_improvements' into 'release/v3.3'
esp_https_ota: component refactoring, bugfixes and feature additions (backport v3.3)

See merge request espressif/esp-idf!6047
2019-10-21 10:40:37 +08:00
ganeshlandge 61486620c7 fixes : set_url discards username and password 2019-10-12 10:50:27 +05:30
Jitin George 7726102bfb esp_http_client: Add support to disable validation of certificate's CN field 2019-10-09 14:02:48 +00:00
Jitin George 23a8cbb247 esp_http_client: Add API for adding authorization info
There was existing support for adding authorization info in esp_http_client
but it was functional only while using `esp_http_client_perform` API. This commit just moves
existing authorization addition logic into publicly exposed API.
2019-10-09 14:02:48 +00:00
Roland Dobai cc3ba7186f esp_http_client: fix CI issues & return value 2019-08-28 16:46:04 +05:30
Nguyễn Hồng Quân 7d28c02fd5 Fix: Lost username when setting new URL with a path.
Closes https://github.com/espressif/esp-idf/pull/3250
2019-08-28 14:54:59 +05:30
Jitin George ff2624f09c esp_http_client: Fix header sent event bug 2019-07-21 07:24:11 +00:00
Angus Gratton 3cd8538f53 Merge branch 'backport/bugfix_url_redirect_v33' into 'release/v3.3'
Fix url redirection issue. (backport v3.3)

See merge request idf/esp-idf!4851
2019-05-03 14:15:33 +08:00
Vikram Dattu c9b1e1df60 Add a `esp_http_client_set_redirection` function.
When using direct operations instead of `esp_http_client_perform`, we need a way to set redirection URL when we get 30x response codes. Added the function for the same.

User can now check status code and call `esp_http_client_set_redirection` function to enable redirection.

Related change in adf: https://gitlab.espressif.cn:6688/adf/esp-adf-internal/merge_requests/187

Closes https://github.com/espressif/esp-idf/issues/2712

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-24 14:10:10 +05:30
Vikram Dattu d154723a84 Fix url redirection issue.
Operation:
In `esp_http_client_set_url`, we check for if old_host is same as new_host.
Delete and open new connection if host is different.

Issue:
We just pointed `client->connection_info.host` to `old_host` and reassigned it.
This made old_host and new_host always point to same location and hence, using old_host with new request.

Fix:
Made a separate copy for old_host using strdup.

Closes https://github.com/espressif/esp-idf/issues/2631

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-23 14:28:53 +05:30
Mahavir Jain 27e00cf7aa esp_http_client: add support for using certs from global ca store
Closes https://github.com/espressif/esp-idf/issues/3062
2019-02-27 14:19:06 +05:30
Roland Dobai 37126d3451 Correct Kconfigs according to the coding style 2019-01-29 13:37:01 +01:00
Damian Reboredo 41e71c2f53 fix esp_http_client_open
client->post_len was not bein set therefore content-length was 0

Closes https://github.com/espressif/esp-idf/pull/2917
2019-01-23 16:47:23 +05:30
Anders Kalør 8b72dc9fb0 esp_http_client: Add support for mutual authentication
Closes https://github.com/espressif/esp-idf/pull/2688
2019-01-23 16:47:23 +05:30
Jitin George 4a667ee12c esp_http_client: Fix config member path's incorrect setting issue 2019-01-21 19:08:24 +08:00
Jitin George e2ae69f6fb Minor Bugfixes in esp_http_client, tcp_transport and simple_ota_example 2019-01-07 16:33:41 +08:00
Jiang Jiang Jian ef4a87d62e Merge branch 'bugfix/http_literal_caseinsensitive' into 'master'
Compare case-insensitive URI schemes

See merge request idf/esp-idf!3558
2018-11-12 17:03:06 +08:00
Damian Reboredo 049c9f7bea esp_http_client: Fix infinite loop on esp_http_client_fetch_headers
error must also be returned if esp_tls_conn_read return 0 because socket  was closed

Merges https://github.com/espressif/esp-idf/pull/2534
2018-11-08 15:57:11 +05:30
Jitin George 3551b84c3a esp_http_client: Fix crash in async mode
Closes https://github.com/espressif/esp-idf/issues/2624
2018-10-30 09:58:57 +00:00
Anton Maklakov 6e6f07ba59 http: Compare case-insensitive URI schemes like as in other places 2018-10-25 21:03:44 +08:00
David Cermak e02225cc07 tcp_transport: renamed possibly generic function names to be esp_ prefixed and not to colide with user namespace 2018-10-02 14:16:48 +02:00
David Cermak 40c6cbb3ab tcp_transport: renamed transport related header files to esp_ prefixed to avoid collisions
tcp_transport component used public header files such as 'transport.h', etc. which are too generic and might collide with user or user libraries headers
This change closes #2417
2018-10-02 14:15:00 +02:00
Jitin George 5309ca04d1 esp_http_client: Add support for non-blocking feature in esp_http_client_perform() API
Four internal APIs `esp_http_client_connect()`, `http_client_prepare_first_line()`, `esp_http_client_request_send()` and
`esp_http_client_send_post_data()` API have been added for perfoming connection establishment (sync as well as async),
preparing first line, sending request and sending post data respectively.

In `transport_ssl`, `ssl_connect_async()` API has been added for establishing asynchronous connection.
2018-09-24 05:42:28 +00:00
David Cermak 23345d2021 MQTT: Integrate esp-mqtt library into idf
added docs and tests for mqtt library, small fixes (removed warnings, option for custom outbox, websocket bug fixed for longer transports). refactored to use common tcp_transport component, support for CMake build system.
Closes #2108
2018-09-12 08:00:59 +02:00
Renz Christian Bagaporo d9939cedd9 cmake: make main a component again 2018-09-11 09:44:12 +08:00
Angus Gratton c5265b12dd Merge branch 'feature/http_client_custom_method' into 'master'
esp_http_client: add support OPPTIONS/SUB/UNSUB/NOTIFY methods

See merge request idf/esp-idf!3214
2018-09-10 14:44:27 +08:00
Tuan PM 738d49e02b esp_http_client: add support OPPTIONS/SUB/UNSUB/NOTIFY methods 2018-09-07 03:06:09 +00:00
Angus Gratton a9c4ed7139 Merge branch 'master' into feature/cmake 2018-08-30 18:51:01 +08:00
Ivan Grokhotkov 9ab70d5379 Merge branch 'bugfix/http_write_data' into 'master'
esp_http_client: Fix minor bugs in `esp_http_client_write` and `esp_http_client_open` APIs

See merge request idf/esp-idf!2924
2018-08-22 16:49:29 +08:00
Jitin George 4d6dcb71ce esp_http_client: Add esp-tls APIs in SSL transport of esp_http_client
esp-tls APIs and SSL transport layer of esp_http_client try to
achieve similar things, so this is an effort to remove code redundancy.
2018-08-21 09:07:07 +00:00
Jitin George 2122e5f83d esp_http_client: Fix minor bugs in esp_http_client_write and esp_http_client_open APIs
`esp_http_client_write` API puts a constraint on the maximum length of the data that can be
written, which is equal to client handle buffer size, but the data to be sent can be more
than that, so in this case, this API has to be called multiple times.

In `esp_http_client_open` API, the return value of `transport_write` API, used to send HTTP
request, is not checked, and in rare cases, data written will be less than expected which will
cause a problem. So there are fixes for these minor issues in this MR.
2018-08-20 10:41:42 +00:00
Angus Gratton ff2404a272 Merge branch 'master' into feature/cmake 2018-08-16 17:14:17 +10:00
Angus Gratton f4b23d1505 Merge branch 'bugfix/http_client_null_auth_header' into 'master'
esp_http_client: Fixed exception on 401 without Www-Authenticate header

See merge request idf/esp-idf!2900
2018-08-10 13:44:55 +08:00
Ivan Grokhotkov ee3f64cbad Merge branch 'feature/http_client_head' into 'master'
esp_http_client: add head method support

See merge request idf/esp-idf!2895
2018-08-08 20:58:39 +08:00
Tuan PM 9aec055ac2 esp_http_client: Fixed exception on 401 without Www-Authenticate header
Closes https://github.com/espressif/esp-idf/issues/2246
2018-08-05 06:24:53 +00:00
Jitin George 2d79af3b13 esp_http_client: Add support for getting transport type 2018-08-03 16:47:08 +05:30
Tuan PM 2718a5f674 Add http_buffer description 2018-08-01 07:14:36 +00:00
Tuan 5589954800 esp_http_client: fixed http chunked encoding packet loss & add check data before read for ssl transport
- A bug of the http client when it downloads a chunked encoding packet is greater than the http_client's buffer, http_parser will call the callback body more than once, and the client will only handle the last
- with ssl_read, need to check before read to avoid timeout blocked when no data for reading
2018-08-01 07:14:36 +00:00
Jason Kölker 483c3d7a7b esp_http_client: add head method support
Merges https://github.com/espressif/esp-idf/pull/2093
2018-07-31 11:08:31 +03:00
Tuan PM 6ef558320a esp_http_client: Resolve some bugs from the github community
- Closes https://github.com/espressif/esp-idf/issues/2135
- Closes https://github.com/espressif/esp-idf/issues/2208
- Closes https://github.com/espressif/esp-idf/issues/2213
2018-07-23 12:22:19 +07:00
Jitin George 9ae3df7ec2 esp_http_client: Fix content-type header overwritten by esp_http_client_set_post_field
Also, references of non-existent function `esp_http_client_finalize_open` is removed
from `esp_http_client` documentation.

Closes https://github.com/espressif/esp-idf/issues/2047

Closes https://github.com/espressif/esp-idf/issues/2040
2018-06-20 10:49:26 +05:30
Angus Gratton 6b9784cc45 Merge branch 'master' into feature/cmake_update 2018-05-31 14:46:23 +10:00
Tuan PM 64ce589f6f Remove unused macro 2018-05-22 12:04:47 +07:00
Tuan PM f2aea4f5b6 Add http status enum & return ESP_FAIL as error code 2018-05-22 10:55:18 +07:00