This commit is contained in:
yushijinhun 2018-12-31 12:33:04 +08:00
parent cbc1e8c664
commit 1148e0c6bc
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4
4 changed files with 11 additions and 22 deletions

View file

@ -130,7 +130,7 @@ public class URLProcessor {
try {
return reverseProxy(session, target);
} catch (IOException e) {
Logging.HTTPD.log(Level.WARNING, "Reserve proxy error", e);
Logging.HTTPD.log(Level.WARNING, "Reverse proxy error", e);
return Response.newFixedLength(Status.BAD_GATEWAY, MIME_PLAINTEXT, "Bad Gateway");
}
} else {
@ -154,7 +154,7 @@ public class URLProcessor {
InputStream clientIn = session.getInputStream();
Logging.HTTPD.fine(() -> "Reserve proxy: > " + method + " " + url + ", headers: " + requestHeaders);
Logging.HTTPD.fine(() -> "Reverse proxy: > " + method + " " + url + ", headers: " + requestHeaders);
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod(method);
@ -182,7 +182,7 @@ public class URLProcessor {
} catch (IOException e) {
upstreamIn = conn.getErrorStream();
}
Logging.HTTPD.fine(() -> "Reserve proxy: < " + responseCode + " " + reponseMessage + " , headers: " + responseHeaders);
Logging.HTTPD.fine(() -> "Reverse proxy: < " + responseCode + " " + reponseMessage + " , headers: " + responseHeaders);
IStatus status = new IStatus() {
@Override

View file

@ -1,5 +1,7 @@
package moe.yushi.authlibinjector.internal.fi.iki.elonen;
import static java.nio.charset.StandardCharsets.US_ASCII;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -32,12 +34,12 @@ class ChunkedOutputStream extends FilterOutputStream {
public void write(byte[] b, int off, int len) throws IOException {
if (len == 0)
return;
out.write(String.format("%x\r\n", len).getBytes());
out.write(String.format("%x\r\n", len).getBytes(US_ASCII));
out.write(b, off, len);
out.write("\r\n".getBytes());
out.write("\r\n".getBytes(US_ASCII));
}
public void finish() throws IOException {
out.write("0\r\n\r\n".getBytes());
out.write("0\r\n\r\n".getBytes(US_ASCII));
}
}

View file

@ -237,8 +237,8 @@ public abstract class NanoHTTPD {
public HTTPSession(InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) {
this.inputStream = new BufferedInputStream(inputStream, HTTPSession.BUFSIZE);
this.outputStream = outputStream;
this.remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : inetAddress.getHostAddress().toString();
this.remoteHostname = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "localhost" : inetAddress.getHostName().toString();
this.remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : inetAddress.getHostAddress();
this.remoteHostname = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "localhost" : inetAddress.getHostName();
this.headers = new HashMap<>();
}
@ -388,7 +388,7 @@ public abstract class NanoHTTPD {
}
// Create a BufferedReader for parsing the header.
BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, this.rlen)));
BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, this.rlen), US_ASCII));
// Decode the header into parms and header java properties
Map<String, String> pre = new HashMap<>();

View file

@ -3,8 +3,6 @@
package moe.yushi.authlibinjector.internal.org.json.simple.parser;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
class Yylex {
@ -279,17 +277,6 @@ class Yylex {
zzReader = in;
}
/**
* Creates a new scanner.
* There is also Reader version of this constructor.
*
* @param in
* the Inputstream to read input from.
*/
Yylex(InputStream in) {
this(new InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
*