* WiFiClientSecure: use _timeout setting when connecting
This timeout value can be customized via a call to setTimeout function.
Closes https://github.com/esp8266/Arduino/issues/3944.
* WiFiClientSecure: increase default connection timeout to 15 sec
* WiFiClientSecure: don't decrypt when testing for 'connected'
* WiFiClientSecure: don't trash unread decrypted data when writing
When application requests to write data, check if there is any unread
decrypted data left. If there is, don't write immediately, but save the
data to be written. When all decrypted data has been consumed by the
application, send out the saved outgoing data.
Fixes https://github.com/esp8266/Arduino/issues/2256.
Mainly useful for testing WiFiClientSecure in local environments.
If allowSelfSignedCerts is called before verifyCertChain, then the
certificate chain will be verified, but the final certificate may be
self-signed.
The ax_port_malloc, ax_port_calloc, ax_port_realloc, and ax_port_free
functions in WiFiClientSecure are not actually used by the AXTLS library.
It's directly using the library routines, and these function are never
used. Remove these dead bits of code to make the axtls operation clearer.
When WiFiClientSecure::connect was called, it would first tear down and
existing and set up new TCP session, then tear down existing TLS session
(using ssl_free), and then set up a new one. This caused TLS close-
notify alert to be sent to the new TCP session, preventing new session
from being established. This change postpones setting IO ctx to the new
TCP connection, fixing this issue.
Ref https://github.com/esp8266/Arduino/issues/3330
WiFiClient write timeouts introduced in #3257 applied to the whole write
operation, which could take long time if data size was large. This
change makes the timeout happen per chunk. Timeout now happens if no
data has been delivered within a given interval.
Some websites have certificates with uppercase letters in CN. This change
makes _verifyDN function accept such certificates by converting all names
to lower case before comparing them.
Resolves#2978
Previously, _write_some function would be called each time TCP stack
notifies the application that some data was delivered (via the `sent`
callback). In turn, _write_some would obtain more data to be sent from
the DataSource. In case of a DataSource backed by a Stream, this would
read from a stream. Some libraries (such as SD) may call `yield` and
other blocking operations from Stream read function, which can not be
used in TCP stack callbacks.
This change moves the data sending loop back into the Arduino task, with
a negligible loss of performance. TCP callback now wakes the main task
via `esp_schedule`, which performs stream read and provides more data
to the TCP stack.
Possible future optimization would be to buffer Stream data ahead of
time. That way, buffered data could be sent immediately from the TCP
callback. On the other hand, this optimization would need extra TCP_MSS
of temporary storage, per connection.
Fixes#2399.
- update ssl_client_new signature
- add max fragment length negotiation support (hardcoded to 4096 bytes)
- build axtls with -f{function,data}-sections, ~1k less DRAM usage,
~3k less flash
- strip prefix from build paths in debug symbols
* minimum changes for libraries to compile with lwip2
* add WiFiClient::availableForWrite() (similar to Serial::) which indicates how much data can be sent without buffering
- add probe request event handler (#2910)
- update WiFi events handling example to use new handler
Pro tip: replace blinking LED with ‘analogWrite’ and connect the pin to
a loudspeaker (or use a servo to hit a bell). Get notified when someone
with a smartphone wanders around your country house.
* Suppressed -Wunused-parameter and -Wunused-function by casting to void unused identifiers.
* Explicit initialization of all fields to suppress -Wmissing-field-initializers.
* Fixed signed/unsigned integer comparison.
* memset initialization of structs.
* More -Wunused-parameter fixes.
Many people have problems with using ESP8266 as WiFi-client due to
none of the examples mentioning that you should use WIFI_STA if you
only want the ESP8266 to act as a WiFi-client. Many WiFi-devices
will randomly try to connect to the ESP8266 if used as STA+AP and
complain about not being able to access the Internet or other devices
on the network.