A simple web server that can be bound to either the EthernetInterface or the WiflyInterface.
Dependents: Smart-WiFly-WebServer WattEye X10Svr SSDP_Server
Diff: SW_HTTPServer.h
- Revision:
- 49:cd391662f254
- Parent:
- 48:078adbe279ac
- Child:
- 52:611a3b360f8c
- Child:
- 53:e5d96abe5e9b
diff -r 078adbe279ac -r cd391662f254 SW_HTTPServer.h --- a/SW_HTTPServer.h Sat Apr 08 19:39:51 2017 +0000 +++ b/SW_HTTPServer.h Sun Apr 09 18:39:37 2017 +0000 @@ -302,16 +302,17 @@ * @param[in] maxqueryParams defines the maximum number of query parameters to a dynamic function * (and the memory to support them). * @param[in] maxdynamicpages defines the maximum number of dynamic pages that can be registered. + * @param[in] blockingtime is the time that the Poll process will pause, waiting for input. * @param[in] pc is the serial port for debug information (I should transform this to a log interface) * @param[in] allocforheader is the memory allocation to support the largest expected header from a client * @param[in] allocforfile is the memory allocation to support sending a file to the client. This is * typically sized to fit an ethernet frame. - * @param[in] blockingtime is the time that the Poll process will pause, waiting for input. */ HTTPServer(int port = 80, const char * webroot = "/", int maxheaderParams = 15, int maxqueryParams = 30, int maxdynamicpages = 10, - PC * pc = NULL, int _allocforheader = MAX_HEADER_SIZE, int _allocforfile = FILESEND_BUF_SIZE, - int blockingtime = 10); + int blockingtime = 10, + PC * pc = NULL, int _allocforheader = MAX_HEADER_SIZE, int _allocforfile = FILESEND_BUF_SIZE + ); /** * Destructor, which can clean up memory. @@ -411,7 +412,7 @@ * each with the \r\n termination (which includes \r\n termination at the end). * If this parameter is NULL, a standard template response will be sent consisting * of "Max-age: 0\r\nServer: Smart_Server v0.2\r\nConnection: close\r\n\r\n" - * If this parameter is not NULL, the user must call headerend(), or ensure that + * If this parameter is not NULL, the user must call header(""), or ensure that * the termination double (\r\n\r\n) ends the optional_text. */ void header(HeaderCodes code = Not_Found, const char * code_text = "Not Found", const char * content_type = NULL, @@ -420,6 +421,12 @@ /** * Send a fragment of a header to the client. * + * @code + * ... + * svr->header("NextParam: 14\r\n"); + * svr->header(""); // sends the final \r\n to end the header + * @endcode + * * This API lets you send header information a fragment at a time. A fragment can be a single * line of text, or it can be several strung together with \r\n. *