|
|
@ -1175,7 +1175,7 @@ static int http_parse_request(HTTPContext *c) |
|
|
|
char *p; |
|
|
|
char *p; |
|
|
|
enum RedirType redir_type; |
|
|
|
enum RedirType redir_type; |
|
|
|
char cmd[32]; |
|
|
|
char cmd[32]; |
|
|
|
char info[1024], *filename; |
|
|
|
char info[1024], filename[1024]; |
|
|
|
char url[1024], *q; |
|
|
|
char url[1024], *q; |
|
|
|
char protocol[32]; |
|
|
|
char protocol[32]; |
|
|
|
char msg[1024]; |
|
|
|
char msg[1024]; |
|
|
@ -1209,11 +1209,7 @@ static int http_parse_request(HTTPContext *c) |
|
|
|
http_log("New connection: %s %s\n", cmd, url); |
|
|
|
http_log("New connection: %s %s\n", cmd, url); |
|
|
|
|
|
|
|
|
|
|
|
/* find the filename and the optional info string in the request */ |
|
|
|
/* find the filename and the optional info string in the request */ |
|
|
|
p = url; |
|
|
|
p = strchr(url, '?'); |
|
|
|
if (*p == '/') |
|
|
|
|
|
|
|
p++; |
|
|
|
|
|
|
|
filename = p; |
|
|
|
|
|
|
|
p = strchr(p, '?'); |
|
|
|
|
|
|
|
if (p) { |
|
|
|
if (p) { |
|
|
|
pstrcpy(info, sizeof(info), p); |
|
|
|
pstrcpy(info, sizeof(info), p); |
|
|
|
*p = '\0'; |
|
|
|
*p = '\0'; |
|
|
@ -1221,6 +1217,8 @@ static int http_parse_request(HTTPContext *c) |
|
|
|
info[0] = '\0'; |
|
|
|
info[0] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pstrcpy(filename, sizeof(filename)-1, url + ((*url == '/') ? 1 : 0)); |
|
|
|
|
|
|
|
|
|
|
|
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { |
|
|
|
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { |
|
|
|
if (strncasecmp(p, "User-Agent:", 11) == 0) { |
|
|
|
if (strncasecmp(p, "User-Agent:", 11) == 0) { |
|
|
|
useragent = p + 11; |
|
|
|
useragent = p + 11; |
|
|
@ -1248,12 +1246,16 @@ static int http_parse_request(HTTPContext *c) |
|
|
|
strcpy(filename + strlen(filename)-2, "m"); |
|
|
|
strcpy(filename + strlen(filename)-2, "m"); |
|
|
|
} else if (match_ext(filename, "rtsp")) { |
|
|
|
} else if (match_ext(filename, "rtsp")) { |
|
|
|
redir_type = REDIR_RTSP; |
|
|
|
redir_type = REDIR_RTSP; |
|
|
|
compute_real_filename(filename, sizeof(url) - 1); |
|
|
|
compute_real_filename(filename, sizeof(filename) - 1); |
|
|
|
} else if (match_ext(filename, "sdp")) { |
|
|
|
} else if (match_ext(filename, "sdp")) { |
|
|
|
redir_type = REDIR_SDP; |
|
|
|
redir_type = REDIR_SDP; |
|
|
|
compute_real_filename(filename, sizeof(url) - 1); |
|
|
|
compute_real_filename(filename, sizeof(filename) - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// "redirect" / request to index.html
|
|
|
|
|
|
|
|
if (!strlen(filename)) |
|
|
|
|
|
|
|
pstrcpy(filename, sizeof(filename) - 1, "index.html"); |
|
|
|
|
|
|
|
|
|
|
|
stream = first_stream; |
|
|
|
stream = first_stream; |
|
|
|
while (stream != NULL) { |
|
|
|
while (stream != NULL) { |
|
|
|
if (!strcmp(stream->filename, filename) && validate_acl(stream, c)) |
|
|
|
if (!strcmp(stream->filename, filename) && validate_acl(stream, c)) |
|
|
|