nanohttpd: refactor x2

This commit is contained in:
Haowei Wen 2020-08-26 00:35:22 +08:00
parent 05f61d92c6
commit 2df9dde936
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4

View file

@ -219,22 +219,20 @@ public abstract class NanoHTTPD {
throw new ResponseException(Status.BAD_REQUEST, "BAD REQUEST: Missing URI.");
}
String uri = st.nextToken();
String rawUri = st.nextToken();
// Decode parameters from the URI
int qmi = uri.indexOf('?');
if (qmi >= 0) {
this.queryParameterString = uri.substring(qmi + 1);
this.parms = Collections.unmodifiableMap(decodeParms(this.queryParameterString));
uri = decodePercent(uri.substring(0, qmi));
this.uri = decodePercent(rawUri.substring(0, qmi));
} else {
this.queryParameterString = null;
this.parms = Collections.emptyMap();
uri = decodePercent(uri);
this.uri = decodePercent(rawUri);
}
this.uri = uri;
// If there's another token, its protocol version,
// followed by HTTP headers.
// NOTE: this now forces header names lower case since they are