1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

87 Commits

Author SHA1 Message Date
Allman-astyler
eea9999dc5 Revert "Allman now (#6080)" (#6090)
This reverts commit 98125f88605cd7e46e9be4e1b3ad0600dd5d2b51.
2019-05-14 00:09:54 +02:00
Allman-astyler
98125f8860 Allman now (#6080)
* switch restyle script for CI

* remove confirmation

* restyle with allman
2019-05-13 16:41:34 +02:00
david gauchard
e67cc90b7a
Honor timeout in HTTPClient (#6056)
* check for timeout in ESP8266HTTPClient::writeToStreamDataBlock
2019-05-06 21:26:17 +02:00
Develo
0da6906499
Update DigestAuthorization.ino (#6029)
Fix WiFiClient vs. HttpClient declaration order
2019-05-01 00:47:20 -04:00
Develo
33a4c6a5a7 Update StreamHttpClient.ino (#6030)
Fix WiFiClient vs. HttpClient declaration order
Fixes #6028
2019-04-30 18:15:58 -07:00
david gauchard
e5b4de3633
fix DEBUG macros (#5728)
* fix DEBUG macros

All fmt strings in flash
fix #5658

This also allows to avoid warnings and easy mistakes with (no brace):
    if (something)
        DEBUGV("blah");

* use newlib unaligned-compatible printf for DEBUGV

* remove useless putprintf since ::printf already uses ets_putc
2019-03-14 11:19:21 +01:00
liebman
e46ccae9d5 optionally allow redirects on HTTPClient & OTA updates (#5009)
* optionally allow redirects on http OTA updates

* Refactored HTTPClient::begin(url...) & setURL functions, now only beginInternal parses URL, sets ports
Added HTTPRedirect example.

* fix indentation for style check

* add space after while for style check

* don't use deprecated begin method in redirect example

* moved redirect handling code to HTTPClient.
only GET and HEAD requests are currently handled automatically
Redirects that fail to be automatically handled return the redirect code as before

* added support for POST/303 redirect
added device redirect tests

* add missing getLocation() implementation

* if the new location is only a path then only update the URI
2019-03-13 01:51:17 +01:00
david gauchard
92373a9837 Deprecate axTLS, update examples (#5366)
* update examples

* fix serial<->tcp example, use STASSID instead of SSID (name collision)

* fix HTTPSRequest.ino

* update AxTLS HTTPS examples, update AxTLS API to deprecated

* fixes

* fixes + fix astyle (no preproc directives) + restyling script

* fix HTTPClient library

* fixes

* common.sh: do not reload arduino when already present (for locally CI testing)

* common.sh: do not reload ArduinoJson when already present (for locally CI testing)

* fix

* fix

* fix deprecated example

* fix WiFiHTTPSServer.ino

* reduce footprint

* wipfix

* fix led builtin

* fix example

* finished updating APSSID on all examples

* style

* restyle examples

* helper to run CI test locally

* local CI runner more verbose

* +const

* deprecation deprecation

* deprecation

* Update NTPClient.ino

const char[] => const char *

* Update interactive.ino

const char[] => const char *
2018-11-29 20:49:27 -08:00
david gauchard
116da1881c update HTTPCLIENT_1_1_COMPATIBLE (#5389)
* update HTTPCLIENT_1_1_COMPATIBLE: #if instead if #ifdef, set to 1 by default
host emulation updates

* host CI: minor simplification

* revert -j
2018-11-29 10:42:44 -08:00
Earle F. Philhower, III
fcdffc5dfd
Save 2.3K in HTTPClient debug mode by PSTR (#5387)
Convert the HTTPClient debug macro to store strings in PROGMEM and
use the printf_P method to dump them.

Saves ~2.3KB heap when in debug mode.
2018-11-29 06:37:07 -08:00
david gauchard
74ca42f829 Sketch emulation on host (#5342)
* WIP compile examples on host with 'make examples'

* WIP bufferize tcp input

* WIP Makefile

* WIP network to rework, tcp/udp to factorize, udp addresses broken

* minor changes to the core

* WIP basic udp working

* WIP mdns

* WIP mcast receiving, not sending

* WIP mdns OK

* beta version

* SSL + doc

* update travis host test command

* licenses

* typo

* doc: arduino builder is not around: declare functions before calling them

* fix with latest SSL PR, compile in 32 bits mode

* fix make clean

* make -m32 optional

* 32bits compiler ability tester

* WIP

* WIP (fix 1 vtable error, still another one to hunt with using spiffs)

* example astyle

* fix os_printf_plus

* load / save mock spiffs

* fix style

* fix using spiffs/mock

* don't mess ram

* update doc

* remove leftover

* optimization -Os except for CI, rename ARCH32 to FORCE32

* revert useless cast (not even compiled)

* remove unused function

* use proper type for pointer arithmetics

* makefile: sketch object and cpp file moved to bin/ directories
easier to clean, and IDE don't like them

* changes for review

* make use of %zd

* less verbose makefile by default (option)

* update readme
2018-11-20 18:51:45 -02:00
liebman
a42c3c399b Fix device/test_http_client tests (#5309)
* update HTTPClient API usage
skip the second POST as end() has different semantics and nulls the client pointer
use bearssl in ssl tests
add delay in python side when shutting down http web server so MacOS does not complain about address already in use

* fix crash if GET/POST was called after end() without a new begin()
update double POST test to insure no crash if POST called after end()
test now are for both AxTLS and BearSSL

* fix small comment typo
2018-11-06 22:56:10 -03:00
Jeroen88
e954022b94 Bugfix/esp8266 http client (#5250)
* Removed _client->stop() from destructor; some minor changes

* Changed BasicHttpsClient.ino to allocate BearSSL::WiFiClientSecure object on the heap in stead of stack

* Removed unnecessary code

* Correcting bad fix for #5216

* Minor formatting to pass Travis tests

* Changed client * to std::unique_ptr<> client

* Updated example
2018-10-21 10:42:55 -03:00
Jeroen88
c8497da676 ESP8266httpClient crash-on-destructor bugfix (#5220)
* Removed _client->stop() from destructor; some minor changes

* Changed BasicHttpsClient.ino to allocate BearSSL::WiFiClientSecure object on the heap in stead of stack
2018-10-11 15:34:25 -07:00
Jeroen88
13f374666d Add WiFiClient parameter to HTTPClient (#4980)
Make HTTPClient take a WiFiClient parameter, allowing you to pass in a
simple HTTP WiFiClient or a BearSSL or axTLS WiFiClientSecure with
any desired verification options.  Deprecate the older, TLSTraits methods.
Add basic HttpsClient example.

Add optional LED feedback to the Update class
2018-10-06 07:50:03 -07:00
Mick Wheeler
1de0c341b5 Support for concatenation of headers (#4864)
If the server returns several headers of the same key (e.g Set-Cookie) only the last one is returned, causing issues in communicating with some servers where cookies are required.

This change concatenates the headers of the same key separated by "," to alleviate this issue.
2018-10-04 05:50:48 -07:00
per1234
4e3af9795b Add missing keywords.txt files to bundled libraries (#5183) 2018-09-29 10:48:23 -07:00
yoursunny
bbaea5a358 ESP8266HTTPClient: allow getString() more than once (#5091)
fixes #4951
2018-09-09 00:34:20 -03:00
david gauchard
85e68093e9
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system (#5018)
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system 

* enable dot_a_linkage on internal libraries
* add device tests
* boards generator: deprecate --noextra4k/--allowWPS and fix documentation
2018-08-20 14:35:52 +02:00
Earle F. Philhower, III
e3c970210f
Add BearSSL client and server, support true bidir, lower memory, modern SSL (#4273)
BearSSL (https://www.bearssl.org) is a TLS(SSL) library written by
Thomas Pornin that is optimized for lower-memory embedded systems
like the ESP8266. It supports a wide variety of modern ciphers and
is unique in that it doesn't perform any memory allocations during
operation (which is the unfortunate bane of the current axTLS).

BearSSL is also absolutely focused on security and by default performs
all its security checks on x.509 certificates during the connection
phase (but if you want to be insecure and dangerous, that's possible
too).

While it does support unidirectional SSL buffers, like axTLS,
as implemented the ESP8266 wrappers only support bidirectional
buffers. These bidirectional buffers avoid deadlocks in protocols
which don't have well separated receive and transmit periods.

This patch adds several classes which allow connecting to TLS servers
using this library in almost the same way as axTLS:
BearSSL::WiFiClientSecure - WiFiClient that supports TLS
BearSSL::WiFiServerSecure - WiFiServer supporting TLS and client certs

It also introduces objects for PEM/DER encoded keys and certificates:
BearSSLX509List - x.509 Certificate (list) for general use
BearSSLPrivateKey - RSA or EC private key
BearSSLPublicKey - RSA or EC public key (i.e. from a public website)

Finally, it adds a Certificate Authority store object which lets
BearSSL access a set of trusted CA certificates on SPIFFS to allow it
to verify the identity of any remote site on the Internet, without
requiring RAM except for the single matching certificate.
CertStoreSPIFFSBearSSL - Certificate store utility

Client certificates are supported for the BearSSL::WiFiClientSecure, and
what's more the BearSSL::WiFiServerSecure can also *require* remote clients
to have a trusted certificate signed by a specific CA (or yourself with
self-signing CAs).

Maximum Fragment Length Negotiation probing and usage are supported, but
be aware that most sites on the Internet don't support it yet.  When
available, you can reduce the memory footprint of the SSL client or server
dramatically (i.e. down to 2-8KB vs. the ~22KB required for a full 16K
receive fragment and 512b send fragment).  You can also manually set a
smaller fragment size and guarantee at your protocol level all data will
fit within it.

Examples are included to show the usage of these new features.

axTLS has been moved to its own namespace, "axtls".  A default "using"
clause allows existing apps to run using axTLS without any changes.

The BearSSL::WiFi{client,server}Secure implements the axTLS
client/server API which lets many end user applications take advantage
of BearSSL with few or no changes.

The BearSSL static library used presently is stored at
https://github.com/earlephilhower/bearssl-esp8266 and can be built
using the standard ESP8266 toolchain.
2018-05-14 20:46:47 -07:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
Parham Alvani
332e059724 ESP8266HTTPClient: add digest authentication example (#4112) 2018-01-10 16:27:25 +08:00
Ivan Grokhotkov
237f7d9b18 ESP8266HTTPClient: allow changing connection timeout using setTimeout (#4038)
Call Client::setTimeout before connection to influence connection
timeout.

Closes https://github.com/esp8266/Arduino/issues/3451.
2017-12-27 23:53:31 -03:00
Christopher Liebman
db1cfc7772 handle empty uri
http.begin("http://www.google.com") yields an empty uri and makes a broken request "GET  HTTPi/1.1"
2017-12-26 19:14:14 +01:00
James Stanley
2abbc36da4 Put WiFi into station mode in examples (#3731) 2017-10-22 13:53:01 +08:00
Rémy HUBSCHER
ed20eb5b3e ESP8266HTTPClient: update library.properties (#3406) 2017-09-22 03:57:28 -05:00
Joe Todd
c9dc8e1717 ESP8266HTTPClient: Add PATCH request (#3590) 2017-09-22 03:52:13 -05:00
Trygve Laugstøl
2d9e767630 Fixing a few compiler warnings to allow compilation with -Wall -Wextra and -Werror. (#3153) 2017-05-08 04:56:08 -05:00
Albert J wong
c6c54e710f Use correct cast for downcasting reference.
For downcasting, static_cast<> is the appropriate cast. Using reinterpret_cast<> will NOT correctly adjust the `this` pointer and dereferencing such a value is undefined by spec. See [expr.reinterpret.cast]p7 for the relevant passage. The only legal use of this pointer is in another set of reinterpret_cast expressions that either land it into a numeric value, or back to the original type.
2017-01-05 11:36:56 -06:00
Allen Smith
4dd9fef491 Fixed PUT(String) method, it called POST in error
About the simplest change possible, just delete two characters and add one. The PUT(String) convenience method called the full POST method instead of calling the PUT method
2016-10-28 14:12:38 -04:00
Fabian Desoye
3fc3e9a99d Added PUT Request to HTTP Client (#2310)
* Added PUT Request to HTTP Client

* Replaced Tabstops with spaces
2016-07-26 18:23:38 +08:00
Ivan Grokhotkov
dd81336b79 ESP8266HTTPClient: fix duplicate Content-Length headers (#1902) 2016-06-03 16:11:44 +08:00
Ivan Grokhotkov
a26ec346b3 Merge pull request #2057 from scottfitzenrider/base64Authorization-strip-newlines
Update ESP8266HTTPClient.cpp
2016-06-01 11:04:43 +08:00
Hideki Shiro
2df4a0b426 allow HTTP header value without LWS. 2016-05-27 00:42:47 +09:00
scottfitzenrider
0ac37810ca Update ESP8266HTTPClient.cpp
The libb64 base64 library adds newlines to the base64 encoding of the encoded _base64Authorization String if the encoded string every 72 characters.  This causes problems with the Authorization: Basic http header when the username and password are long.  The change strips out newlines from _base64Authorization right before the header is sent.
2016-05-25 15:07:14 -04:00
b-pas
74bd4f9200 include non-standard ports in Host: header 2016-05-07 10:56:24 -04:00
Ivan Grokhotkov
334837533f Add missing virtual destructor in TransportTraits (#1944) 2016-04-26 16:00:46 +08:00
Ivan Grokhotkov
76e322f2e7 Fix handling of chunked transfer encoding (#1975) 2016-04-26 15:58:12 +08:00
Ivan Grokhotkov
edaae2c194 HTTPClient: fix default port not being set 2016-04-25 21:03:39 +08:00
Ivan Grokhotkov
81d3bb3e3a Return error when HTTPClient::begin is called with HTTPS URL without certificate fingerprint (#1941) 2016-04-22 19:21:57 +08:00
Ivan Grokhotkov
84daa1a108 Add explicit cast (#1903) 2016-04-13 14:03:11 +03:00
Ivan Grokhotkov
46380003d5 Fix compilation when debug is enabled 2016-04-13 14:02:10 +03:00
Ivan Grokhotkov
a455f22587 HTTPClient, HTTPUpdate: save some RAM by moving strings into flash 2016-04-09 12:46:29 +03:00
Ivan Grokhotkov
bf7f33d918 Fix code formatting 2016-04-09 12:46:29 +03:00
Ivan Grokhotkov
bbc5e9ba01 Update library versions 2016-04-09 12:46:29 +03:00
Ivan Grokhotkov
cae4039225 HTTPClient: decouple transport layer handling 2016-04-09 12:46:29 +03:00
Ivan Grokhotkov
93d57fabe2 Remove overloads of HTTPClient::begin which take const char*
Since the data is stored as Strings internally, these methods do not serve as an optimisation
2016-04-09 12:46:29 +03:00
Markus Sattler
1060db94c2 handle possible dead lock in HTTP client see: #1520 2016-01-29 14:02:09 +01:00
Markus Sattler
27f1a63170 allow String for payload in HTTPclient sendRequest 2016-01-29 13:19:56 +01:00
Markus Sattler
4247b646bb Merge remote-tracking branch 'remotes/esp8266/master' 2016-01-16 14:01:19 +01:00