projects
/
platform
/
upstream
/
libwebsockets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
09f3947
)
url cleaning: leave // after http[s]: alone
author
Andy Green
<andy@warmcat.com>
Fri, 21 Jul 2017 12:04:02 +0000
(20:04 +0800)
committer
Andy Green
<andy@warmcat.com>
Fri, 21 Jul 2017 12:04:02 +0000
(20:04 +0800)
lib/server.c
patch
|
blob
|
history
diff --git
a/lib/server.c
b/lib/server.c
index
108321d
..
f588b4e
100644
(file)
--- a/
lib/server.c
+++ b/
lib/server.c
@@
-689,6
+689,17
@@
lws_unauthorised_basic_auth(struct lws *wsi)
int lws_clean_url(char *p)
{
int lws_clean_url(char *p)
{
+ if (p[0] == 'h' && p[1] == 't' && p[2] == 't' && p[3] == 'p') {
+ p += 4;
+ if (*p == 's')
+ p++;
+ if (*p == ':') {
+ p++;
+ if (*p == '/')
+ p++;
+ }
+ }
+
while (*p) {
if (p[0] == '/' && p[1] == '/') {
char *p1 = p;
while (*p) {
if (p[0] == '/' && p[1] == '/') {
char *p1 = p;
@@
-997,7
+1008,10
@@
lws_http_action(struct lws *wsi)
"%s%s%s/", oprot[!!lws_is_ssl(wsi)],
lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST),
uri_ptr);
"%s%s%s/", oprot[!!lws_is_ssl(wsi)],
lws_hdr_simple_ptr(wsi, WSI_TOKEN_HOST),
uri_ptr);
+
+ lwsl_notice("%s\n", end);
lws_clean_url((char *)end);
lws_clean_url((char *)end);
+ lwsl_notice("%s\n", end);
n = lws_http_redirect(wsi, HTTP_STATUS_MOVED_PERMANENTLY,
end, n, &p, end);
n = lws_http_redirect(wsi, HTTP_STATUS_MOVED_PERMANENTLY,
end, n, &p, end);