1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

58 Commits

Author SHA1 Message Date
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
2528013c5d
small addons (#5847)
* make (static) ESP8266WebServer::responseCodeToString visible and usable
* esp8266:coreVersionNumeric(): add a define and comment-example to check on its usability
2019-03-07 11:37:38 +01:00
DiamondDrake
8f28c88f9c Added naive content length to upload struct (#5142)
Content length provides context into the size of the upload, it's not
the exact form body size it's off by the request header info, but it was
already parsed by the library and provides little to no additional
overhead to pass on for use in request handlers.
2018-11-29 17:24:55 -08: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
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
david gauchard
64dd492eaa fix parseArgument #2 (#5252)
* fix parseArgument

* remove recursion

* keep variable naming style consistent

* inviting Alexa

* fix alexa fix (well, trying...)

* fix pos substrings

key_end_pos--;
dont count down here, it will cut of every key by -1 ("save" will be "sav") (substring  (end = up to, but not including, so no need to -1)

Parsing cpp L329
arg.value = urlDecode(data.substring(equal_index + 1, next_index - 1));
=> -1 is too less for substring (substring  (end = up to, but not including, so no need to -1)

* alexa invite: add workaround for malformed x-www-form-urlencoded

* when !form, alway add content in key "plain"

* fix memleak

* parse arguments: use functors

* cleaning
2018-10-16 23:18:45 -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
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
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
david gauchard
89e5a481a7 increase HTTP SEND/POST timeout to 5s (#3971) 2017-12-16 00:01:43 -03: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
Chris Mullins
72ed29ad5f allow for overridable value for HTTP_UPLOAD_BUFLEN 2017-05-01 05:33:20 -05: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
35fd2ccd52 Make ESP8266WebServer::urlDecode public (#1419) 2016-06-13 15:17:17 +08:00
shiro
dbef28d394 add "include <ESP8266WiFi.h>" to ESP8266WebServer.h (#2094) 2016-06-06 12:21:01 +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
f6516b004f ESP8266WebServer: fix handling of empty POST
Fix handling of case when Content-Length is 0.
Change do {} while() loop into while(){} so that we don't wait 1000ms for data in case Content-Length is 0.
Also fix handling of cases when malloc or realloc return null.
2016-04-18 10:33:10 +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
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
Markus Sattler
55afeba174 see #1167
add close and stop as alias
2015-12-10 12:02:49 +01: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
Joost Jager
ac8cfa0143 Merge branch 'master' into master 2015-11-23 21:22:42 +01:00
Joost Jager
34fcc911bc Url decode added for search parameters 2015-11-22 15:57:32 +01: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
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
Ivan Grokhotkov
4c8a29a74d Expose request handlers in ESP8266WebServer
as discussed in #837
2015-10-06 15:26:42 +03:00
Miguel Angel Ajo
b4cc0c263e Handle form upload abortion in ESP8266WebServer
If the client connection gets closed during a form upload,
the fileUploadHandler is notified with the new
UPLOAD_FILE_ABORTED status, and the loop is ended
gracefully.
2015-09-28 21:42:16 +02:00
Ivan Grokhotkov
5e3fb60390 Merge pull request #778 from CanTireInnovations/httpOptions
Adding support for OPTIONS requests to ESP8266WebServer
2015-09-18 09:54:50 +03:00
Jeff Ashton
eb8c1faa51 Adding support for OPTIONS requests to ESP8266WebServer 2015-09-13 15:56:34 -04:00
Martin Ayotte
27b67f4adc add ESP8266WebServer::send_P with contentLength argument 2015-09-06 14:17:23 -04:00
Martin Ayotte
82748a872c add ESP8266WebServer::sendContent_P with 'size_t size' argument for binary content 2015-09-06 13:27:12 -04:00
aalku
5a91c66615 Host header support 2015-08-19 13:20:01 +03:00
Ivan Grokhotkov
278c980ed8 Make file uploads using curl fail less often 2015-08-18 23:40:33 +03:00
Ivan Grokhotkov
43d80ee2ec Fix forward declaration of FS 2015-08-12 22:40:21 +03:00
Ivan Grokhotkov
5cbaa57af9 Resolve naming conflicts between FS and SD library 2015-08-05 08:36:43 -04:00
Ivan Grokhotkov
e8b27912d7 ESP8266WebServer: serve static files from FS 2015-08-05 07:44:00 -04:00
Makuna
8fa156d356 send_P, sendContent_P, and FPSTR
This allows for the content of server response to be stored in flash
memory.
2015-07-24 12:41:26 -07:00
Ivan Grokhotkov
e5fcdbd9e3 ESP8266WebServer: reduce amount of string copying 2015-06-24 23:58:53 +03:00
Ivan Grokhotkov
8fdb824e11 Add setContentLength method to web server, update examples
related to #304
2015-05-22 17:57:30 +03:00
ficeto
866ab26433 add gzip content support for HTML File streaming 2015-05-21 14:05:00 +03:00
ficeto
555813545c Make the web server not waste heap
added some helper methods as well
2015-05-19 14:06:34 +03:00
ficeto
1cd9cd312f add folder api for SPIFFS 2015-05-16 02:29:26 +03:00