@@ -92,24 +92,23 @@ class ESP8266WebServer
9292 void onNotFound (THandlerFunction fn); // called when handler is not assigned
9393 void onFileUpload (THandlerFunction fn); // handle file uploads
9494
95- String uri () { return _currentUri; }
96- HTTPMethod method () { return _currentMethod; }
95+ const String& uri () const { return _currentUri; }
96+ HTTPMethod method () const { return _currentMethod; }
9797 virtual WiFiClient client () { return _currentClient; }
9898 HTTPUpload& upload () { return *_currentUpload; }
9999
100- String arg (String name); // get request argument value by name
101- String arg (int i); // get request argument value by number
102- String argName (int i); // get request argument name by number
103- int args (); // get arguments count
104- bool hasArg (String name); // check if argument exists
100+ const String& arg (String name) const ; // get request argument value by name
101+ const String& arg (int i) const ; // get request argument value by number
102+ const String& argName (int i) const ; // get request argument name by number
103+ int args () const ; // get arguments count
104+ bool hasArg (const String& name) const ; // check if argument exists
105105 void collectHeaders (const char * headerKeys[], const size_t headerKeysCount); // set the request headers to collect
106- String header (String name); // get request header value by name
107- String header (int i); // get request header value by number
108- String headerName (int i); // get request header name by number
109- int headers (); // get header count
110- bool hasHeader (String name); // check if header exists
111-
112- String hostHeader (); // get request host header if available or empty String if not
106+ const String& header (String name) const ; // get request header value by name
107+ const String& header (int i) const ; // get request header value by number
108+ const String& headerName (int i) const ; // get request header name by number
109+ int headers () const ; // get header count
110+ bool hasHeader (String name) const ; // check if header exists
111+ const String& hostHeader () const ; // get request host header if available or empty String if not
113112
114113 // send response to the client
115114 // code - HTTP response code, can be 200 or 404
@@ -129,12 +128,12 @@ class ESP8266WebServer
129128
130129 static String urlDecode (const String& text);
131130
132- template <typename T>
131+ template <typename T>
133132 size_t streamFile (T &file, const String& contentType) {
134133 _streamFileCore (file.size (), file.name (), contentType);
135134 return _currentClient.write (file);
136135 }
137-
136+
138137protected:
139138 virtual size_t _currentClientWrite (const char * b, size_t l) { return _currentClient.write ( b, l ); }
140139 virtual size_t _currentClientWrite_P (PGM_P b, size_t l) { return _currentClient.write_P ( b, l ); }
@@ -144,19 +143,19 @@ class ESP8266WebServer
144143 bool _parseRequest (WiFiClient& client);
145144 void _parseArguments (const String& data);
146145 int _parseArgumentsPrivate (const String& data, std::function<void (String&,String&,const String&,int ,int ,int ,int )> handler);
147- static String _responseCodeToString (int code);
148- bool _parseForm (WiFiClient& client, String boundary, uint32_t len);
146+ static const String _responseCodeToString (int code);
147+ bool _parseForm (WiFiClient& client, const String& boundary, uint32_t len);
149148 bool _parseFormUploadAborted ();
150149 void _uploadWriteByte (uint8_t b);
151150 uint8_t _uploadReadByte (WiFiClient& client);
152151 void _prepareHeader (String& response, int code, const char * content_type, size_t contentLength);
153152 bool _collectHeader (const char * headerName, const char * headerValue);
154-
153+
155154 void _streamFileCore (const size_t fileSize, const String & fileName, const String & contentType);
156155
157- String _getRandomHexString ();
156+ static String _getRandomHexString ();
158157 // for extracting Auth parameters
159- String _extractParam (String& authReq,const String& param,const char delimit = ' "' );
158+ String _extractParam (String& authReq,const String& param,const char delimit = ' "' ) const ;
160159
161160 struct RequestArgument {
162161 String key;
0 commit comments