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

989 Commits

Author SHA1 Message Date
per1234
7999f5c29c Use correct separator in keywords.txt
The Arduino IDE currently requires the use of a tab separator between the name and identifier. Without this tab the keyword is not highlighted.

Reference:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords
2018-03-05 15:51:14 +08:00
david gauchard
a2e7c7d016 (bool)WiFiClient needs to return ::connected() since ClientContext is not destroyed on ::stop() (#4422) 2018-03-02 20:27:08 -03:00
Ivan Grokhotkov
1349bafd83 [WIP] ESP8266WiFi: initialize new fields, remove old workaround (#4413)
* ESP8266WiFi: initialise new STA configuration fields

* ESP8266WiFi: remove workaround for wifi_station_ap_number
2018-02-28 17:21:32 -03:00
Ivan Grokhotkov
ee5a1e2804 WiFiClient: don’t destroy ClientContext on ::stop
Reported in https://github.com/esp8266/Arduino/issues/4078.

WiFiClient::stopAll, called from a WiFi disconnected event handler,
could be called while WiFiClient::connect was in progress. This issue
was initially fixed in #4194, by testing `this` pointer for being
non-null in ClientContext::connect.

This change delegates deletion of ClientContext to WiFiClient
destructor. WiFiClient::stop only calls ClientContext::stop, which
closes/aborts the connection.
2018-02-20 03:33:55 +03:00
Ivan Grokhotkov
28d8a41219 ESP8266WiFi: zero-initialise scan_config structure
Fixes #4394
2018-02-20 03:33:03 +03:00
Ivan Kravets
dcb67599b5
Revert "Remove @PlatformIO library.json from GDBStub; fix pattern in LD"
Reverts esp8266/Arduino#4363
2018-02-19 23:28:14 +02:00
Earle F. Philhower, III
f9ac524b13
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
2018-02-17 18:47:10 -08:00
Develo
5328a8b91e
additional mimetable fixes, additional string moves to progmem (#4371) 2018-02-16 16:56:33 -03:00
Earle F. Philhower, III
bb90e12ea0
Fix double-free in ESP8266WebServer (#4365)
In issue #4350, @mongozmaki found that the web server was accessing a
deleted variable in the destructor.  Implement his suggested change
and move the close() before any freeing.  Could also have simply
NULL'd out the _currentHeaders member after freeing as well.

Fixes issue #4350
2018-02-14 07:50:26 -08:00
Ivan Kravets
eb58a31b89 Remove @PlatformIO library.json from GDBStub; fix pattern in LD // Resolve #4355 2018-02-14 00:23:12 +02:00
Earle F. Philhower, III
291bc6bca5
Wrap mimetype strings in FSPTR()s (#4338)
Mimetype is now in progmem, so any accesses to it need to be using FPSTR()
wrapped Strings.

Fixes #4329
2018-02-10 08:12:38 -08:00
Earle F. Philhower, III
bf5a0f24dc Fix mem leak in SSL server, allow for concurrent client and server connections w/o interference (#4305)
* Fix leak on multiple SSL server connections

Fixes #4302

The refcnt setup for the WiFiClientSecure's SSLContext and ClientContext
had issues in certain conditions, causing a massive memory leak on each
SSL server connection.  Depending on the state of the machine, after two or
three connections it would OOM and crash.

This patch replaces most of the refcnt operations with C++11 shared_ptr
operations, cleaning up the code substantially and removing the leakage.

Also fixes a race condition where ClientContext was free'd before the SSLContext
was stopped/shutdown.  When the SSLContext tried to do ssl_free, axtls would
attempt to send out the real SSL disconnect bits over the wire, however by
this time the ClientContext is invalid and it would fault.

* Separate client and server SSL_CTX, support both

Refactor to use a separate client SSL_CTX and server SSL_CTX.  This
allows for separate certificates to be installed on each, and means
that you can now have both a *single* client and a *single* server
running in parallel at the same time, as they'll have separate memory
areas.

Tested using mqtt_esp8266 SSL client with a client certificate and a
WebServerSecure with its own custom certificate and key in parallel.

* Add brackets around a couple if-else clauses
2018-02-08 15:25:24 -03:00
Develo
bb5787a1cd
Fix mdns buffer overrun by 1 (#4317)
* fix mdns buffer overflow, minor indent/prettify
2018-02-07 14:39:27 -03:00
Develo
bcbd5961c0
add begin(port) to esp8266webserver, move some strings to flash, some refactoring (#4148)
* add begin(port) to esp8266webserver, move some strings to flash, some refactoring

* Moved more strings to flash, unified some strings

* move mimetable strings into a standalone file

* more string moves to flash, remove duplicates, refactor of template method, minor styling

* Reverted moving small string to flash (no heap advantage, reduces bin size)
2018-02-07 00:30:07 -03:00
david gauchard
64885fd5cf
minor cosmetics (dead code, -Wallextra) (#4274) 2018-02-07 01:34:46 +01:00
Develo
83f6d83db0
Fix RTCmem example buffer access past end (#4288) 2018-02-06 20:54:03 -03:00
Earle F. Philhower, III
4c23e66bba
SSL server DEBUG, code cleanup fixes (#4280)
The server needs to load an X509 and RSA key, but instead of using
the existing loadObject() calls implemented its own.  Remove them and
use the standard ones instead.

The DEBUG_OUTPUT macro was undefined in the SSL Web server.  Add it
in do that when you compile with DEBUG=HTTP_SERVER it actually compiles.
2018-02-06 07:33:26 -08:00
Earle F. Philhower, III
c8dbfb160b Refrech api.github.com x509 certificate (#4306)
The certificate fingerprint included with the HTTPSRequest example seems
to be for an expired api.github.com certificate.  Replace with the current
one to avoid reporting "certificate mismatch" errors when running.
2018-02-06 11:06:05 -03:00
Earle F. Philhower, III
e38f19e008
Remove warnings when NDEBUG build option used (#4196)
When building using the new NDEBUG option recently added, the assert()
macro is defined to nothing. This leaves a few variables unused in the
WiFi stack causing compiler warnings. Add in empty casts to remove
these warnings. Does not affect actual assert use when NDEBUG is not
defined.
2018-02-04 20:59:31 -08:00
david gauchard
199fe0f16d
ClientContext:_write_some: release buffer once data really accepted for sending (#4265)
may fix #1872
2018-02-01 11:49:04 +01:00
Develo
9ba8f77678
Check that pins needed by Wire are defined at compile-time (#4261) 2018-01-30 14:59:47 -03:00
NameOfTheRose
84228b1c73 Nameoftherose patch for Issue #2435 (#4256)
* WiFiTelnetToSerial Example - Minor Issues #2435

* WiFiTelnetToSerial Example - Minor Issues #2435

Patch to rectify issue #2435
2018-01-29 13:28:28 -03:00
Develo
38fe6fc488
Add timeout to WiFi connection loop in WiFiMulti (#4146) 2018-01-20 14:45:54 -03:00
david gauchard
dd00db1b8c check ClientContext's this and _pcb once out of the ::connect() delay (#4194)
fix #4078
2018-01-18 21:20:33 -03:00
Develo
b08ff10269
Rework of arduino compatibility in WiFiSTAClass::config (#4145) 2018-01-17 15:30:24 -03:00
Zandt Tittle
ca25068733 initialize io_ctx to nullptr 2018-01-12 18:39:10 +08:00
Develo
02259a412c
fixed support for psk in WiFiSTA, added support for psk to WiFiMulti, minor code cleanups (#4076) 2018-01-10 23:15:24 -03:00
Parham Alvani
332e059724 ESP8266HTTPClient: add digest authentication example (#4112) 2018-01-10 16:27:25 +08:00
Earle F. Philhower, III
bd1c7ce1dc Add SSL enabled WiFiServer, Updater, WebServer
Adds SSL server mode for WiFiServerSecure, for plain SSL connections,
ESP8266WebServerSecure, for HTTPS web serving, and SecureHTTPSUpdater for
encrypted OTA updates.

Example code is provided for all new options, as well as a BASH script for
generating their own, self-signed certificates.

Both ESP8266WebServerSecure and SecureHTTPSUpdater are important for secure
password-based authentication.  HTTP Basic Authentication, the only supported
model presently, sends the username and password in *cleartext* and therefore
should *never* be used in any un-SSL encrypted channel unless you don't mind
sharing your login and password with anyone else on the internet.  Even if the
ESP8266 is not safety critical, this cleartext broadcast could expose you should
you reuse this password elsewhere on your network or the internet.
2018-01-10 11:56:32 +08:00
Luis Carlos Becerra Rueda
8765da258b Added WifiServer::begin(uint16_t port) method, listening port can be changed at runtime (#4123) 2018-01-09 22:10:43 -03:00
Karl Palsson
89837fcea5 lib/Ticker: add bool active() (#2722)
* lib/Ticker: add bool active()

Makes it easier to self detach, and check if a timer is still operating.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>

* Code cleanup Ticker.cpp
2018-01-05 01:04:53 -03:00
david gauchard
9cfbbc7ad3 keepalive api (default 2h,75s,9 not enabled) (#3937) 2018-01-05 00:17:37 -03:00
Mike Killewald
fb7c519856 small fix to stop crash on unrecognized packets (#4092) 2018-01-04 20:10:46 -03:00
ZaPpInG
a19ff3517e Update ArduinoOTA.cpp to solve #4086 (#4090)
* Update ArduinoOTA.cpp

* Update ArduinoOTA.cpp
2018-01-04 18:48:56 -03:00
yoursunny
d9ef6b5f18 ArduinoOTA: don't crash on unrecognized packets (#4086)
* ArduinoOTA: handle end of packet in readStringUntil

fixes #3912

* ArduinoOTA: fix buffer overflow in parseInt

fixes #3912
2018-01-04 00:14:32 -03:00
letsbuildit
b0bb1e144f Fix issue with UdpContext.h comment (#4068) 2018-01-02 10:16:06 -03:00
Ville Skyttä
b4653f4d44 Fix URL parameter decoding in web server (#3313)
* Make HTTP server test data easier to examine

* Add HTTP server parameter tests containing & and =

* Fix URL parameter decoding in web server

The parameters string needs to be first split on & and =, and URL
decoding on parts done after that. Otherwise URL encoded & and = within
parameter names and values cause incorrect splitting.
2017-12-30 14:24:37 -03:00
Patrick José Pereira
4ab89d07fc ESP8266WiFiMulti: Add count function (#3073)
Return total number of AP added

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2017-12-30 13:16:47 -03:00
Develo
a2d16f38d4
Extern C blocks (#1352) (#4044)
* Add extern C guard blocks to SDK header files #1352

* fixed some extern C blocks in core and libraries
2017-12-30 02:03:26 -03:00
liebman
1cd4a00cff Remove compiler warnings (#4043) 2017-12-29 13:14:56 -03:00
Joey Babcock
a71118caeb Improve error messages (#2800)
I was having trouble understanding what some of the serial output meant so I changed it to the best of my ability
2017-12-29 11:49:29 -03:00
Rick van Schijndel
28803540a2 Added String hostname support to WiFiClient and WiFiClientSecure (#3349)
* Added String hostname support to WiFiClient and WiFiClientSecure

* Typo in WiFi
2017-12-29 01:58:36 -03:00
Ivan Grokhotkov
1540369c40 Set architecture=esp8266 for bundled SD and Ethernet libraries (#4035)
Fixes https://github.com/esp8266/Arduino/issues/3868.
2017-12-28 12:21:55 -03:00
Hans Winzell
7dd50360b9 Fix bug in WiFiClientBasic.ino (#3902) 2017-12-28 09:47:10 -03:00
Ivan Grokhotkov
3838e58f62 WiFiClientSecure: don't use the broken max_fragment_length extension (#4033)
axTLS does not correctly implement max_fragment_length extension. This
causes servers which understand this extension (currently GnuTLS- and
WolfSSL-based) to reject the client hello.

Until this is fixed in axTLS, remove the call to enable this extension
from WiFiClientSecure.

Fixes https://github.com/esp8266/Arduino/issues/3932.
2017-12-28 01:45:49 -03: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
Ivan Grokhotkov
7fc23c6f7a WiFiUDP: fix crash when calling destinationIP with no packet available (#4036)
Fixes https://github.com/esp8266/Arduino/issues/3989.
2017-12-27 23:15:11 -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
Ivan Grokhotkov
4c08389961 ESP8266WebServer: send empty chunk when done sending chunked response
Fixes https://github.com/esp8266/Arduino/issues/3225
2017-12-26 19:13:19 +01:00
Ivan Grokhotkov
9b3583d227 ESP8266WebServer: add CONTENT_LENGTH_UNKNOWN keyword 2017-12-26 19:13:19 +01:00