Skip to content

Commit dddf279

Browse files
author
QuickSander
committed
Introduced strtok_r. Several small fixes.
1 parent fb0642b commit dddf279

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

examples/HelloHttp/HelloHttp.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ WiFiServer wifiServer(80);
1515
void setup()
1616
{
1717
Serial.begin(115200);
18+
Serial.println("Starting Wifi Connection...");
1819

1920
WiFi.begin(const_cast<char*>(ssid), password);
2021
while (WiFi.status() != WL_CONNECTED)

platformio.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ lib_dir = ../
2020
platform = espressif
2121
framework = arduino
2222
board = esp01
23+
# Custom upload tool to force use of esptool.py instead of default esptool.
24+
# See: http://arduino.stackexchange.com/questions/20219/upload-with-esptool-fails-with-espcomm-send-command-cant-receive-slip-payload
25+
extra_script = ../../Tools/platformio_esptool.py
2326

2427
[env:uno]
2528
platform = atmelavr

src/internals/HttpResource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ bool ArduinoHttpServer::HttpResource::isValid()
3737
//! Retrieve resource part at the specified index.
3838
//! \details E.g. HttpResource("/api/sensors/1/state")[1]
3939
//! returns "sensors"
40-
String ArduinoHttpServer::HttpResource::operator[](const int index) const
40+
String ArduinoHttpServer::HttpResource::operator[](const unsigned int index) const
4141
{
4242
int fromOffset(0);
4343

4444
// Forward till we reach desired index.
45-
for (int currentIndex=0; currentIndex <= index; ++currentIndex)
45+
for (unsigned int currentIndex=0; currentIndex <= index; ++currentIndex)
4646
{
4747
fromOffset = m_resource.indexOf(RESOURCE_SEPERATOR, fromOffset);
4848
++fromOffset; // Seek past '/'.

src/internals/HttpResource.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HttpResource
2525
HttpResource& operator=(const HttpResource& other);
2626

2727
bool isValid();
28-
String operator[](const int index) const;
28+
String operator[](const unsigned int index) const;
2929
const String& toString() const;
3030

3131
private:

src/internals/StreamHttpRequest.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ ArduinoHttpServer::StreamHttpRequest<MAX_BODY_LENGTH>::StreamHttpRequest(Stream&
117117
m_errorDescription(),
118118
m_lineBufferStrTokContext(0)
119119
{
120-
m_stream.setTimeout(LINE_READ_TIMEOUT_MS);
120+
static_assert(MAX_BODY_LENGTH >= 0, "HTTP body length less then zero specified.");
121+
m_stream.setTimeout(LINE_READ_TIMEOUT_MS);
121122
}
122123

123124
//------------------------------------------------------------------------------
@@ -264,6 +265,7 @@ void ArduinoHttpServer::StreamHttpRequest<MAX_BODY_LENGTH>::parseVersion()
264265
message += version;
265266
message += "\".";
266267
setError(message);
268+
267269
}
268270

269271
}

0 commit comments

Comments
 (0)