1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00
Commit Graph

52 Commits

Author SHA1 Message Date
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
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
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
89e5a481a7 increase HTTP SEND/POST timeout to 5s (#3971) 2017-12-16 00:01:43 -03:00
2fbc619569 allocate HTTPUpload struct on demand (#2557) 2017-10-22 13:58:53 +08:00
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
72ed29ad5f allow for overridable value for HTTP_UPLOAD_BUFLEN 2017-05-01 05:33:20 -05:00
4dc4e75216 allow F() to be used for uri parameter (#2319) 2016-07-26 18:23:14 +08:00
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
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
35fd2ccd52 Make ESP8266WebServer::urlDecode public (#1419) 2016-06-13 15:17:17 +08:00
dbef28d394 add "include <ESP8266WiFi.h>" to ESP8266WebServer.h (#2094) 2016-06-06 12:21:01 +08:00
7450dd39ca ESP8266WebServer: save RAM by moving response strings to flash (#1732) 2016-04-18 10:43:00 +03:00
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
4036e3a436 Changed header() to have string parameter instead of const char * 2016-02-03 13:48:35 +01:00
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
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
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
55afeba174 see #1167
add close and stop as alias
2015-12-10 12:02:49 +01:00
bda06d686c Add HTTP Basic Auth to WebServer and libb64 (base64) to core 2015-11-30 03:37:47 +02:00
a44632b8cf make compiler happier 2015-11-25 18:11:16 +02:00
ac8cfa0143 Merge branch 'master' into master 2015-11-23 21:22:42 +01:00
34fcc911bc Url decode added for search parameters 2015-11-22 15:57:32 +01:00
50eb6d9ff2 Make RequestHandler handle uploads 2015-11-19 22:52:52 +02:00
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
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
4c8a29a74d Expose request handlers in ESP8266WebServer
as discussed in #837
2015-10-06 15:26:42 +03:00
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
5e3fb60390 Merge pull request #778 from CanTireInnovations/httpOptions
Adding support for OPTIONS requests to ESP8266WebServer
2015-09-18 09:54:50 +03:00
eb8c1faa51 Adding support for OPTIONS requests to ESP8266WebServer 2015-09-13 15:56:34 -04:00
27b67f4adc add ESP8266WebServer::send_P with contentLength argument 2015-09-06 14:17:23 -04:00
82748a872c add ESP8266WebServer::sendContent_P with 'size_t size' argument for binary content 2015-09-06 13:27:12 -04:00
5a91c66615 Host header support 2015-08-19 13:20:01 +03:00
278c980ed8 Make file uploads using curl fail less often 2015-08-18 23:40:33 +03:00
43d80ee2ec Fix forward declaration of FS 2015-08-12 22:40:21 +03:00
5cbaa57af9 Resolve naming conflicts between FS and SD library 2015-08-05 08:36:43 -04:00
e8b27912d7 ESP8266WebServer: serve static files from FS 2015-08-05 07:44:00 -04:00
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
e5fcdbd9e3 ESP8266WebServer: reduce amount of string copying 2015-06-24 23:58:53 +03:00
8fdb824e11 Add setContentLength method to web server, update examples
related to #304
2015-05-22 17:57:30 +03:00
866ab26433 add gzip content support for HTML File streaming 2015-05-21 14:05:00 +03:00
555813545c Make the web server not waste heap
added some helper methods as well
2015-05-19 14:06:34 +03:00
1cd9cd312f add folder api for SPIFFS 2015-05-16 02:29:26 +03:00
0897f9e2e3 fix reading bytes from incoming POST upload
proper error and premature connection loss should be implemented to
handle weird cases where we might not get the whole post content
2015-05-15 02:22:00 +03:00
3c9d1f20bb Merge branch 'ficeto-esp8266' into esp8266
* ficeto-esp8266:
  add template methods for stream to stream writes to SD and FS
  alignment not needed. we use fixed addresses
  Rework SPIFFS API to be more Arduino like
  fix missed edits
  disable automount
  fix SPIFFS to work
  pull get/set NoDelay for WiFiClient
  Add SPIFFS Support
  export sketch data folder to the build config
  Revert "Revert "Edit SD Server example to use the new Write(Stream) method""
  add template client write
  Revert "Add WiFiClient.write for Stream"
  Revert "Edit SD Server example to use the new Write(Stream) method"
  Edit SD Server example to use the new Write(Stream) method
  Add WiFiClient.write for Stream
  make upload callback packets aligned to defined size

Conflicts:
	hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SDWebServer.ino
	hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp
	hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h
2015-05-14 14:38:22 +03:00
36d0968ada Web server refactoring 2015-05-14 13:33:12 +03:00
c0fdd09132 make upload callback packets aligned to defined size
having this a multiple of 512 bytes helps writing to SDcard
2048 looks reasonable and fast, but could be lowered if too much
2015-05-13 01:09:44 +03:00
a924ba1336 add proper POST support and more methods
GET params are always added
plain POST is added to the GET arguments
Uploads are handled by separate handler
2015-05-08 02:45:03 +03:00
435f59f771 ESP8266WebServer code review, fix indentation, add keywords 2015-05-01 11:17:45 +08:00