You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "chenqiang (JIRA)" <ji...@apache.org> on 2017/10/11 06:38:00 UTC
[jira] [Created] (DIRMINA-1074) HttpServerDecoder bug
chenqiang created DIRMINA-1074:
----------------------------------
Summary: HttpServerDecoder bug
Key: DIRMINA-1074
URL: https://issues.apache.org/jira/browse/DIRMINA-1074
Project: MINA
Issue Type: Bug
Components: Protocol - HTTP
Affects Versions: 2.0.16
Reporter: chenqiang
我使用tcp模拟了一个非正常的http get请求
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());
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)