1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Merge remote-tracking branch 'remotes/esp8266/esp8266' into esp8266

Conflicts:
	hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp
This commit is contained in:
Markus Sattler
2015-06-25 20:02:37 +02:00
8 changed files with 49 additions and 44 deletions

View File

@ -115,7 +115,7 @@ void ESP8266WebServer::handleClient()
_handleRequest();
}
void ESP8266WebServer::sendHeader(String name, String value, bool first) {
void ESP8266WebServer::sendHeader(const String& name, const String& value, bool first) {
String headerLine = name;
headerLine += ": ";
headerLine += value;
@ -129,7 +129,7 @@ void ESP8266WebServer::sendHeader(String name, String value, bool first) {
}
}
void ESP8266WebServer::send(int code, const char* content_type, String content) {
void ESP8266WebServer::send(int code, const char* content_type, const String& content) {
String response = "HTTP/1.1 ";
response += String(code);
response += " ";
@ -155,15 +155,15 @@ void ESP8266WebServer::send(int code, const char* content_type, String content)
sendContent(response);
}
void ESP8266WebServer::send(int code, char* content_type, String content) {
void ESP8266WebServer::send(int code, char* content_type, const String& content) {
send(code, (const char*)content_type, content);
}
void ESP8266WebServer::send(int code, String content_type, String content) {
void ESP8266WebServer::send(int code, const String& content_type, const String& content) {
send(code, (const char*)content_type.c_str(), content);
}
void ESP8266WebServer::sendContent(String content) {
void ESP8266WebServer::sendContent(const String& content) {
size_t size_to_send = content.length();
size_t size_sent = 0;
while(size_to_send) {

View File

@ -77,15 +77,15 @@ public:
// code - HTTP response code, can be 200 or 404
// content_type - HTTP content type, like "text/plain" or "image/png"
// content - actual content body
void send(int code, const char* content_type = NULL, String content = String(""));
void send(int code, char* content_type, String content);
void send(int code, String content_type, String content);
void send(int code, const char* content_type = NULL, const String& content = String(""));
void send(int code, char* content_type, const String& content);
void send(int code, const String& content_type, const String& content);
void setContentLength(size_t contentLength) { _contentLength = contentLength; }
void sendHeader(String name, String value, bool first = false);
void sendContent(String content);
void sendHeader(const String& name, const String& value, bool first = false);
void sendContent(const String& content);
template<typename T> size_t streamFile(T &file, String contentType){
template<typename T> size_t streamFile(T &file, const String& contentType){
setContentLength(file.size());
if (String(file.name()).endsWith(".gz") &&
contentType != "application/x-gzip" &&

View File

@ -9,14 +9,12 @@ public:
protected:
static void _add(T* self) {
DEBUGV("%s %08x %08x\n", __func__, (uint32_t) self, (uint32_t) _s_first);
T* tmp = _s_first;
_s_first = self;
self->_next = tmp;
}
static void _remove(T* self) {
DEBUGV("%s %08x %08x\n", __func__, (uint32_t) self, (uint32_t) _s_first);
if (_s_first == self) {
_s_first = self->_next;
self->_next = 0;