Prechádzať zdrojové kódy

fix unmatched URL length

the `mg_request_info::local_uri` can be changed after `uri_len` was initialized, so its value should be recalculated before using it.
forworldm 3 rokov pred
rodič
commit
a487c99a31
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      src/civetweb.c

+ 1 - 1
src/civetweb.c

@@ -14528,7 +14528,7 @@ handle_request(struct mg_connection *conn)
 	}
 
 	/* 12. Directory uris should end with a slash */
-	if (file.stat.is_directory && (uri_len > 0)
+	if (file.stat.is_directory && ((uri_len = (int) strlen(ri->local_uri)) > 0)
 	    && (ri->local_uri[uri_len - 1] != '/')) {
 
 		size_t len = strlen(ri->request_uri);