Commit 8d5eeb95 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

http_server also accepts request for /image.jpg

parent c6b3de5e
......@@ -12,6 +12,9 @@
#define INFO
#undef DEBUG
// the strncasecmp function is not in the ISO C standard
#define USE_POSIX_FUNCTION
#ifdef USE_CAMERA
#include "camera.h"
#endif
......@@ -178,13 +181,20 @@ int client_write_n(struct client* client, size_t n)
*/
int parse_http_request(const char* buf, size_t sz)
{
#ifdef USE_POSIX_FUNCTION
int r = strncasecmp(buf, "GET ", 4);
int rl = 1;
#else
int r = strncmp(buf, "GET ", 4);
int rl = strncmp(buf, "get ", 4);
#endif
if(r) {
if(r && rl) {
return 501;
}
r = strncasecmp(buf+4, "/ ", 2);
if(r) {
r = strncmp(buf+4, "/ ", 2);
rl = strncmp(buf+4, "/image.jpg ", 11);
if(r && rl) {
return 404;
} else {
return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment