changeset 1221:b99947af8b79

better path parsing
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 25 Mar 2018 17:13:11 -0600
parents 4721c482c86b
children cb422386f6b5
files src/luan/webserver/RequestParser.java
diffstat 1 files changed, 1 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
diff -r 4721c482c86b -r b99947af8b79 src/luan/webserver/RequestParser.java
--- a/src/luan/webserver/RequestParser.java	Wed Mar 21 15:54:57 2018 -0600
+++ b/src/luan/webserver/RequestParser.java	Sun Mar 25 17:13:11 2018 -0600
@@ -71,7 +71,7 @@
 		int start = parser.currentIndex();
 		if( !parser.match('/') )
 			throw new ParseException(parser,"bad path");
-		while( safePathChar() || parser.anyOf("&=") );
+		while( parser.noneOf(" ?#") );
 		request.path = urlDecode( parser.textFrom(start) );
 	}
 
@@ -98,15 +98,6 @@
 		return parser.noneOf("=&# \t\n\f\r\u000b");
 	}
 
-	// where did I get this?
-	private boolean safePathChar() {
-		return parser.inCharRange('A','Z')
-			|| parser.inCharRange('a','z')
-			|| parser.inCharRange('0','9')
-			|| parser.anyOf("-._~:/[]@!$'()*+,;`.%")
-		;
-	}
-
 	private void parseProtocol() throws ParseException {
 		int start = parser.currentIndex();
 		if( !(