Skip to content

fix some warnings and #395 #1087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ File uploadFile;


void returnOK() {
server.sendHeader("Connection", "close");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", "");
}

void returnFail(String msg) {
server.sendHeader("Connection", "close");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(500, "text/plain", msg + "\r\n");
}

Expand Down
9 changes: 6 additions & 3 deletions libraries/ESP8266httpClient/src/ESP8266httpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ httpClient::httpClient() {
_tcp = NULL;
_tcps = NULL;

_port = 0;

_reuse = false;
_https = false;

_headerKeysCount = 0;
_currentHeaders = NULL;
Expand Down Expand Up @@ -345,7 +348,7 @@ int httpClient::writeToStream(Stream * stream) {
DEBUG_HTTPCLIENT("[HTTP-Client][writeToStream] connection closed or file end (written: %d).\n", bytesWritten);

if(_size && _size != bytesWritten) {
DEBUG_HTTPCLIENT("[HTTP-Client][writeToStream] bytesWritten %d and size %d missmatch!.\n", bytesWritten, _size);
DEBUG_HTTPCLIENT("[HTTP-Client][writeToStream] bytesWritten %d and size %d mismatch!.\n", bytesWritten, _size);
}

end();
Expand All @@ -362,7 +365,7 @@ String httpClient::getString(void) {
if(_size) {
// try to reserve needed memmory
if(!sstring.reserve((_size + 1))) {
DEBUG_HTTPCLIENT("[HTTP-Client][getString] too less memory to resive as string! need: %d\n", (_size + 1));
DEBUG_HTTPCLIENT("[HTTP-Client][getString] too less memory to reserve as string! need: %d\n", (_size + 1));
return String("--too less memory--");
}
}
Expand Down Expand Up @@ -511,7 +514,7 @@ bool httpClient::sendHeader(const char * type) {
}
header += "\r\n" + _Headers + "\r\n";

return _tcp->write(header.c_str(), header.length());
return (_tcp->write(header.c_str(), header.length()) == header.length());
}

/**
Expand Down