if (client.available())
{
char c = client.read();
// If it isn't a new line, add the character to the buffer
if (c != '\n' && c != '\r')
{
clientline[index] = c;
index++;
if (index >= BUFSIZ)
index = BUFSIZ -1;
continue;
}
// got a \n or \r new line, which means the string is done
clientline[index] = 0;
Serial.println(clientline);
// Look for substring such as a request to get the root file
if (strstr(clientline, "GET /") != 0)
{
// this time no space after the /, so a sub-file!
char *filename;
filename = clientline + 5; // look after the "GET /" (5 chars)
// a little trick, look for the " HTTP/1.1" string and
// turn the first character of the substring into a 0 to clear it out.
(strstr(clientline, " HTTP"))[0] = 0;
Serial.println(filename);
}
Dort wird das "GET" einfach nach links verschoben und der String mit dem HTTP durch 0 ersetzt.
So kann man das etwas eleganter machen und gleichzeitig auch andere Eingaben verarbeiten.