I'm running a modifed code on Arduino Uno + WiFi shield (updated), and I have seen strange behaviors with
String ; here is my code, the goal is to parse a HTML request to know which page was requested :
String line = client.readStringUntil("\n"); Serial.print("Line : ["); Serial.print(line); Serial.println("]"); String cmd = line.substring(0, 3); Serial.print("Command : ["); Serial.print(cmd); Serial.print("]");
My problem comes from what appears in the console :
Line : [GET / HTTP/1.1 Host: 192.168.43.200 Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding: gzip, deflate, sdch Ac] Command : 
I was expecting the
cmd variable to contain
GET, and I do not understand why it contains nothing.
I suspect this behavior comes from the lack of RAM (compiler says there are only 670 bytes available for local variables), but if it's the case, I do not know how to solve it, as I'm pretty inexperienced in C++ and I need to store a String containing the values that are sent as a reply to the HTTP request.
PS. I'm also wondering why the
client.readStringUntil("\n") method sends the full request instead of only the first line.