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

74 Commits

Author SHA1 Message Date
lukasostendorf
3a36501d6d Fix: some clients were not able to authenticate using DIGEST_AUTH (#5506) 2018-12-18 14:52:14 -03:00
Luc
440a3aae7f Expose post args during upload (#4935)
Currently post args are only available at the end of upload but they are already listed - this PR just expose them with minimal changes
It also set a define for post args array size originaly set to 32
2018-11-29 13:52:55 -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
david gauchard
a063c2b36f
fix http parsing (#5262)
* follows #5252
* use const refs where relevant (aka stop being nasty with ram and cpu)
2018-10-23 22:17:54 +02:00
fabianoms
ad7cb635ed Improved parameter validation (#5256) 2018-10-17 17:08:38 -03: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
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
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
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
liebman
1cd4a00cff Remove compiler warnings (#4043) 2017-12-29 13:14:56 -03: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
Alessio Leoncini
03f1a540ca Added constant time string comparison to avoid possible time-based attacks. (#3836)
* Added constant time strings comparison to avoid possible time-based attacks

* Fixed data types

* Fixed indentation

* Moved string comnparison in constant time to String class; modified function body to assure constant time comparison despite compiler optimizations

* Removed wrong code

* Fixed error and prevented compiler optimization to delete u1 local variable

* Avoid timing attacks on string comparison

* Minor

* changed counter names, removed else
2017-11-21 01:56:05 -03:00
Christian Schuster
e71ec77a00 minimize number of exit paths in ESP8266WebServer::handleClient (#2557) 2017-10-22 13:58:53 +08:00
Christian Schuster
2fbc619569 allocate HTTPUpload struct on demand (#2557) 2017-10-22 13:58:53 +08:00
Ahmed El Sharnoby
eebc5ec593 Digest Authentication in Webserver Library (#3053)
* Add Digest Auth

* Check for Opaque and Nonce

* Remove Serial Debug and fix Indentation

* Added example sketch with documentation,Fixed indentation and Defaults

* Digest Authentication minor changes + new padded 32 digit random function

* update license to public domain

* renaming functions
2017-09-18 05:31:32 -05:00
Me No Dev
4897e0006b match headers using equalsIgnoreCase (#2474)
Should fix: https://github.com/esp8266/Arduino/issues/2131
2016-09-02 11:49:14 +03:00
Clemens Kirchgatterer
4dc4e75216 allow F() to be used for uri parameter (#2319) 2016-07-26 18:23:14 +08:00
Me No Dev
6390cf6bd6 Chunked encoding (#2199)
* Add chunked encoding

example:
```cpp
  server.on("/chunked", HTTP_GET, [](){
    server.send(200, "text/html", String());
    server.sendContent("<!DOCTYPE html><html><head><title>Chunked
Test</title></head><body>");
    server.sendContent("<p>Chunk 1</p>");
    server.sendContent("<p>Chunk 2</p>");
    server.sendContent("<p>Chunk 3</p>");
    server.sendContent("<p>Chunk 4</p>");
    server.sendContent("<p>Chunk 5</p>");
    server.sendContent("<p>Chunk 6</p>");
    server.sendContent("</html>");
    server.sendContent("");//end of chunked
  });
```

* update examples, keep setContentLength and add bool _chunked

* fix wrong session id

* set _chunked to false earlier for cases where users use only sendContent
2016-06-28 14:35:12 +08:00
Ivan Grokhotkov
8db4dcea42 WifiClient::write refactoring (second attempt) (#2177)
* WiFiClient: use DataSource for writes

* ESP8266WebServer: delegate writing to WiFiClient

* ESP8266WebServer: set write timeout before sending content
2016-06-23 17:47:18 +08:00
Ivan Grokhotkov
7450dd39ca ESP8266WebServer: save RAM by moving response strings to flash (#1732) 2016-04-18 10:43:00 +03:00
Ivan Grokhotkov
a14ae347e4 Fix buffer overflow in ESP8266WebServer::authenticate (#1790) 2016-03-18 23:33:35 +03:00
Charles
4036e3a436 Changed header() to have string parameter instead of const char * 2016-02-03 13:48:35 +01:00
Charles
c74a7703d2 Changed Arg hasArg hasHeader from const char * to String
This permet calling these with const char *, String or PGM_P type
parameter
2016-02-03 12:04:03 +01:00
Charles
090c3e3533 Added arg_P hasArg_P and hasHeader_P
Added arg_P hasArg_P and hasHeader_P to be able to test arg from string
stored in flash
2016-02-03 05:29:21 +01:00
Ivan Grokhotkov
ecdbda8796 Merge pull request #1401 from lp0/webserver-async1
WebServer: handle initial read/close timeouts asynchronously
2016-01-18 20:45:41 +03:00
Simon Arlott
d099404eb8 WebServer: handle initial read/close timeouts asynchronously
If there is a delay before data becomes available on a new connection
then the handler function blocks for up to 1 second, and there's another
wait on connection close for up to 2 seconds.

This doesn't make the whole server process asynchronous (there is another
delay between headers/data) but it helps when there are other events
that need attention while handling web requests.
2016-01-10 15:50:34 +00:00
Assaf Inbal
9e61e60b0c A content length of zero should also be sent
This is needed since when the content-length header is not sent the clients will
wait for data anyways. Sending a content length of zero will tell the client not
to expect any content and it will close the connection immediately.
2016-01-10 08:11:40 +02:00
Markus Sattler
2b23b005aa allow control of enabling debug and debug level from IDE 2016-01-02 12:25:39 +01:00
Markus Sattler
55afeba174 see #1167
add close and stop as alias
2015-12-10 12:02:49 +01:00
Me No Dev
4ca084e628 Merge remote-tracking branch 'esp8266/master' into www-basic-auth 2015-11-30 15:00:50 +02:00
Me No Dev
12c71aa899 memory housekeeping 2015-11-30 15:00:47 +02:00
Me No Dev
0c6e11b4ea Merge branch 'master' into www-basic-auth 2015-11-30 10:50:53 +02:00
Ivan Grokhotkov
5a2af5419b WebServer: catch the case when request isn't handled
If RequestHandler::canHandle returns true, but subsequent RequestHandler::handle returns false, we should return some HTTP response instead of an empty one.
2015-11-30 08:42:00 +03:00
Me No Dev
bda06d686c Add HTTP Basic Auth to WebServer and libb64 (base64) to core 2015-11-30 03:37:47 +02:00
Me No Dev
a44632b8cf make compiler happier 2015-11-25 18:11:16 +02:00
Me No Dev
50eb6d9ff2 Make RequestHandler handle uploads 2015-11-19 22:52:52 +02:00
Ivan Grokhotkov
5b28ae23c2 Allow WiFiServer to bind to a specific address (#997)
In addition to the existing constructors (WiFiServer::WiFiServer(port) and WiFiWebServer::WiFiWebServer(port)), new constructors are added:
WiFiServer::WiFiServer(IPAddress, port) and WiFiWebServer::WiFiWebServer(IPAddress, port).
2015-11-15 20:35:52 +03:00
Andrew Melvin
5c6f98643b Changes to static request handler 2015-11-12 07:27:21 +00:00
JohnSL
c0f8ce9d84 Exclude the terminator in sendContent_P
The terminator should not be sent by sendContent_P. For example, if you
have a null-terminated string, the null itself should not be sent to the
client. This change decrements the number of bytes to send so it does
not include the termination character.
2015-11-08 19:28:55 -08:00
Antoine Bertin
fe3003dec3 Update status code reason phrases
As per RFC2616
2015-10-31 16:22:50 +01:00
luc
ee0b8621f3 Add header access using same method as arguments 2
based on @brianensor PR
+sample and some sanity check
2015-10-28 13:58:53 +08:00
John Socha-Leialoha
578c90f04c Fixing final write length for sendContent_P 2015-10-11 13:32:10 -07:00
Ivan Grokhotkov
4c8a29a74d Expose request handlers in ESP8266WebServer
as discussed in #837
2015-10-06 15:26:42 +03:00
Ivan Grokhotkov
001a129c3a Fix heap node corruption (#428) 2015-09-28 11:59:34 +03:00
Ivan Grokhotkov
e0da5a284f Merge pull request #753 from martinayotte/esp8266
add ESP8266WebServer::sendContent_P and ESP8266WebServer::send_P with contentLength
2015-09-18 09:54:04 +03:00
Ivan Grokhotkov
e62d5a92b9 Fix ESP8266WebServer::serveStatic to work for both files and directories 2015-09-14 12:47:39 +03:00
Martin Ayotte
5cb086bc05 temporarly fix for handling PGM_P content_type properly in ESP8266WebServer::send_P() functions 2015-09-09 12:03:07 -04:00
Martin Ayotte
27b67f4adc add ESP8266WebServer::send_P with contentLength argument 2015-09-06 14:17:23 -04:00
Martin Ayotte
1c9456ac9d fix bug in WiFiClient::write_P/ESP8266WebServer::sendContent_P introduced few minutes ago when changing memccpy_P to memcpy_P 2015-09-06 14:14:36 -04:00