Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Abandoned
-
2.0.16
-
None
-
None
Description
I used TCP to simulate a non normal HTTP get request
StringBuilder sb = new StringBuilder("GET");
sb.append(" ");
sb.append("/system.ini?loginuse&loginpas");
sb.append(" ");
sb.append("HTTP/1.1");
sb.append("\r\n");
sb.append("Connection");
sb.append(": ");
sb.append("keep-alive");
sb.append("\r\n");
sb.append("Host");
sb.append(": ");
sb.append("host");
sb.append("\r\n");
sb.append("\r\n");
//error data
sb.append("000");
sb.append("000");
byte[] bytes = sb.toString().getBytes();
Socket socket = new Socket("localhost", 8001);
OutputStream outputStream = socket.getOutputStream();
outputStream.write(bytes);
outputStream.flush();
After parsing a request, HttpServerDecoder returns to ProtocolCodecFilter,
When you find that there is data in buffer, you will continue to call the HttpServerDecoder.decode method
Since the request header string is used directly in parseHttpRequestHead (buffer.array), the program is stuck in a dead loop
final String raw = new String(buffer.array(), 0, buffer.limit());