You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2017/10/26 19:10:00 UTC

[jira] [Commented] (DIRMINA-1074) HttpServerDecoder bug

    [ https://issues.apache.org/jira/browse/DIRMINA-1074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16221038#comment-16221038 ] 

Emmanuel Lecharny commented on DIRMINA-1074:
--------------------------------------------

May you provide a unit test I can play with ?

> 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
>
> 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());



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)