[
https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678057#action_12678057
]
Emmanuel Lecharny commented on DIRMINA-666:
-------------------------------------------
@headers : The RFC names the header "Content-Length", not "content-length".
Even if the headers' name are case insensitive. This is what I meant.
@example : the code you are mentioning is just given has an example, and should
not be viewed as "production-ready". It worths what it worths : it's just there
to demonstrate how to use MINA, not to implement RFC 2616. If you want to use
it to develop your own stack handling HTTP over MINA, fine. But this was not -
and will never - be the intention of this portion of the code. In no way it's
supposed to be more than example.
However, my first intention was to add the comment you suggested, I just forget
to mention it in my previous comment. I will add it in 1.1.8-trunk.
The comment has been committed with revision 749411
> HTTP header parsing example incompatible with rfc2616 / content-length field
> name should be interrepted as case-insensitive
> ---------------------------------------------------------------------------------------------------------------------------
>
> Key: DIRMINA-666
> URL: https://issues.apache.org/jira/browse/DIRMINA-666
> Project: MINA
> Issue Type: Bug
> Components: Example
> Affects Versions: 1.1.0
> Environment: Linux
> Reporter: Janne Siren
> Assignee: Emmanuel Lecharny
> Priority: Critical
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> Qt4 (4.4.3) QHttp class sends HTTP/POST command with HTTP header which has
> "content-length" field name in small letters. HTTP header parsing
> functionality in MINA Example does not accept these POST commands as it
> expects case-sensitive field name "Content-Length". MINA Example HTTP header
> parser functionality incorrectly drops these POST messages send by Qt4 QHttp
> class although those messages are fully compatible with rfc2616. Cut from
> rfc2616 (4.2 Message Headers): Field names are case-insensitive.
> The problem (at least in MINA-1.1.0) is in
> org.apache.mina.example.httpserver.codec.HttpRequestDecoder.java:
> private static final byte[] CONTENT_LENGTH = new String( "Content-Length:" )
> .getBytes();
> ...
> boolean found = false;
> for( int j = 0; j < CONTENT_LENGTH.length; j++ )
> {
> if( in.get( i + j ) != CONTENT_LENGTH[
> j ] )
> {
> found = false;
> break;
> }
> found = true;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.