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

51 Commits

Author SHA1 Message Date
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
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
43d80ee2ec Fix forward declaration of FS 2015-08-12 22:40:21 +03:00
timw1971
15991fb35a Improvements to ESP8266WebServer::sendContent
Now makes only one call to .c_str() and using pointer tracking, rather that recalculating offset within the sending loop, to manage data window.

Moved invariant code out of the sending loop body.
2015-08-08 11:48:18 +01: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
John Doe
d441d8485e allow proper content length handling 2015-06-16 00:25:34 +03:00
Ivan Grokhotkov
8fdb824e11 Add setContentLength method to web server, update examples
related to #304
2015-05-22 17:57:30 +03:00
Ivan Grokhotkov
21d50e104c Web server: disconnect at the end of callback, not after sendContent (#304) 2015-05-22 16:19:08 +03:00
Markus Sattler
94850752b8 add some return headers to WebServer 2015-05-20 18:58:06 +02:00
ficeto
555813545c Make the web server not waste heap
added some helper methods as well
2015-05-19 14:06:34 +03:00
Ivan Grokhotkov
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
Ivan Grokhotkov
36d0968ada Web server refactoring 2015-05-14 13:33:12 +03:00
ficeto
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
ficeto
1f657fab73 plaintext POST fixes and rework of the SD example
Added a single file web editor/browser/uploader and all needed methods
to work with the files on the SD Card
2015-05-11 13:43:26 +03:00
ficeto
7001086920 fix binary file http upload 2015-05-09 14:21:53 +03:00
ficeto
7e0a104cb5 fix huge leak 2015-05-08 03:30:41 +03:00
ficeto
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
Ivan Grokhotkov
435f59f771 ESP8266WebServer code review, fix indentation, add keywords 2015-05-01 11:17:45 +08:00
ficeto
81af3a061e adding extra finctionaity the the web server
void onNotFound(bool(void)) handler routes and errors not in the
defined handlers
int args() returns nubmer of currentarguments
String arg(int i) returns the "i" argument value
String argName(int i) returns the "i" argument name(key)
bool hasArg(const char * name) looks up if an argument exist by
seraching for it's key
2015-05-01 02:43:51 +03:00
Markus Sattler
2472970933 fix some warnings
warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=]
warning: defined but not used [-Wunused-variable]
warning: declared 'static' but never defined [-Wunused-function]
warning: suggest parentheses around '&&' within '||' [-Wparentheses}
2015-04-29 07:01:28 +08:00