This is a port to work with the Particle TCPServer and TCPClient implementations. It is a lot faster then the last port/implementation, because that introduced the fixmedelay()
macro of 20ms. A test request took 300ms with it and 30ms without... I assumed that the bug is solved (at least on the Photon it runs perfect).
I actually hope this library gets obsolete soon, since there is already an HTTPServer implementation for Wiced (the Particle Soft AP HTTP Server makes use of this). I hope that they open it up in the Particle API with AP support. Otherwise the Adafruit HTTPServer implementation for their WICED Feather WiFi might be an interesting start (unfortunately I don't have the C skills to start with that).
This is an Arduino-based Web Server library, originally developed for a class at NYC Resistor. It's called Webduino, and it's an extensible web server library for the Arduino using the Wiznet-based Ethernet shields. It's released under the MIT license allowing all sorts of reuse.
- URL parameter parsing
- Handle the following HTTP Methods: GET, HEAD, POST, PUT, DELETE, PATCH
- Web Forms
- Images
- JSON/RESTful interface
- HTTP Basic Authentication
With Arduino 1.0, add the Webduino folder to the "libraries" folder of your sketchbook directory.
You can put the examples in your own sketchbook directory, or in hardware/libraries/webduino/examples, as you prefer.
If you get an error message when building the examples similar to "WebServer.h not found", it's a problem with where you put the Webduino folder. The server won't work if the header is directly in the libraries folder.
These have all been tested with the library successfully:
- Freetronics Etherten
- Freetronics Ethernet Shield
- Arduino Ethernet
- Arduino Ethernet Shield, both original and updated microSD version
- Adafruit Ethernet Shield w/ Wiznet 811MJ module
- NKC Electronics Ethernet Shield DIY Kit
Shields using the Microchip ENC28J60 chip won't work with the library as that requires more software support for implementating the TCP/IP stack.
- Uses new the new Particle library structure.
- fixed bug with compatibility with original version of Ethernet library
- added httpNotFound() method to output 404 error message
- added processConnection(uint8_t sock) and processConnection(uint8_t sock, char *buff, int *bufflen) methods
- increased size of 'm_contentLength' to 'long int'
- fixed Google Code issue 4 where expect fails with high-ASCII characters due to sign issues
- fixed Google Code issue 8 by adding WEBDUINO_NO_IMPLEMENTATION macro that allows including the class definition without the implementation code
- fixed Google Code issue 9: allowing prog_char* strings for printP
- added httpServerError() method to output 500 Internal Server Error message
- added support for HTTP PUT, DELETE, and PATCH methods (see Google Code issue 11
- fixed Google Code issue 12: off-by-one error in name/value parser (readPOSTparam) where the buffer wouldn't ever be completely filled
- updated copyright string for 2012 and major authors
- GitHub fork now the official version; all open issues on Google Code site fixed or closed and moved to GitHub
- added checkCredentials and httpUnauthorized methods as well as readHeader method for HTTP Basic Authentication; currently users will have to do the Base64 encoding outside of Webduino and I'm uncertain whether I ever want this inside the library or not...
- fixed the request parser: previously the command dispatcher would always pass true for tail_complete, even if the tail was incomplete
- fixed the command dispatcher: previously the default command could not have a tail, but the EPIC FAIL was returned
- added a default favicon.ico based on the led.png from the Image example to save resources on Firefox trying to load this file on every request if it can't be loaded
- added keywords.txt for syntax highlighting in Arduino IDE
- bumped the version number up in response headers and compiler variables
- added version history to readme
- fixed default value for prefix
- fixed /index.html in Hello World example
- project forked on GitHub by Chris Lee
- JSON/RESTful interface
- header Access-Control-Allow-Origin added
- code split in .h and .cpp files
- Arduino 1.0 changes by Dave Falkenburg and others
- adding CRLF after extraHeaders
- fix examples to use readPOSTparam method
- bug fix for multple connections
- major bug fix for 1.3 for posts where Content-Length is last header sent
- mostly robustness fixes (beta)
- fixed HelloWorld example
- now with GET parameter handling