sirleech/Webduino — pull request #25 by polyphemus (2012-11-27 07:34:16+00:00)
Title: Add setUrlPathCommand method, which adds support for resolving the URL i...

...n the function itself, when it doesn't match default or specified paths.

Modified Command prototype, UrlPathCommand, now returns the extra parameter char **url_path. url_path contains pointers to the separate parts of the URL path.

int len_url_path = 0, n = 0;
while (*(url_path + n++)) ++len_url_path;

if (len_url_path)
{
if (strncmp(url_path[0], "400", 4) == 0)
{
server.httpFail();
if (!tail_complete) {
server << "buffer to small for url\n";
}
return;
}
}

server.httpSuccess();

server << "url_parts=" << len_url_path << "\n";

for (uint8_t i = 0; i < len_url_path; i++)
{
server << "url_part=";
char *p = url_path[i];

while (*p != 0) server << *p++;

server << "\n";
}