You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Janne Siren (JIRA)" <ji...@apache.org> on 2009/03/01 21:57:12 UTC

[jira] Created: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

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
            Priority: Critical


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Janne Siren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677957#action_12677957 ] 

Janne Siren commented on DIRMINA-666:
-------------------------------------

Here is the fix proposal. This is made on top of MINA-1.1.0 (Thanks Alex).
We have tested that the problem exists also in latest stable version 1.1.7, but we are quite busy with other tasks so we did not made corrections to 1.1.7 version.
We have not tested with unstable 2.0.x version.

Hopefully you can merge this to stable 1.1.x branch and check that this problem does not exist or gets corrected in unstable 2.0.x branch.

Index: HttpRequestDecoder.java
===================================================================
--- HttpRequestDecoder.java	(revision 1)
+++ HttpRequestDecoder.java	(working copy)
@@ -43,7 +43,8 @@
  */
 public class HttpRequestDecoder extends MessageDecoderAdapter
 {
-	private static final byte[] CONTENT_LENGTH = new String( "Content-Length:" )
+	// modified to support case-insensitive header
+	private static final byte[] CONTENT_LENGTH = new String( "content-length:" )
 			.getBytes();
 
 	private CharsetDecoder decoder = Charset.defaultCharset()
@@ -130,7 +131,8 @@
 				boolean found = false;
 				for( int j = 0; j < CONTENT_LENGTH.length; j++ )
 				{
-					if( in.get( i + j ) != CONTENT_LENGTH[ j ] )
+					// modified to support case-insensitive header
+					if (in.get(i + j) != CONTENT_LENGTH[j] && in.get(i + j) != (CONTENT_LENGTH[j]-20))
 					{
 						found = false;
 						break;
@@ -198,6 +200,10 @@
 			while( ( line = rdr.readLine() ) != null && line.length() > 0 )
 			{
 				String[] tokens = line.split( ": " );
+				// modified to support case insensitive header
+                if (tokens[0].equalsIgnoreCase("content-length")) {
+                	tokens[0] = "Content-Length";
+                }
 				map.put( tokens[ 0 ], new String[] { tokens[ 1 ] } );
 			}


> 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.


[jira] Commented: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677858#action_12677858 ] 

Emmanuel Lecharny commented on DIRMINA-666:
-------------------------------------------

Just to be sure, are you refering to class HttpResponseDecodingState ?

> 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
>            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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ASYNCWEB-26) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ASYNCWEB-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680013#action_12680013 ] 

Emmanuel Lecharny commented on ASYNCWEB-26:
-------------------------------------------

Moved to AsyncWeb, as the Content-Length header is considered as case-sensitive, when it should not be.

> HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASYNCWEB-26
>                 URL: https://issues.apache.org/jira/browse/ASYNCWEB-26
>             Project: Asyncweb
>          Issue Type: Bug
>         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.


[jira] Assigned: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny reassigned DIRMINA-666:
-----------------------------------------

    Assignee: Emmanuel Lecharny

> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677982#action_12677982 ] 

Emmanuel Lecharny commented on DIRMINA-666:
-------------------------------------------

The patch won't work :
- it should be (CONTENT_LENGTH[j]-32)) 
- passing contentmlength will be accepted, as 'm' = '-' +32

Moreover, I think that fixing the code is not necessary. First because it's just an example, second because it's very rare that software are passing case insensitive headers (the RFC uses case sensitive headers for thise specific headers). 

However, I would like to transfer this issue to the ASYNCWEB project, as it's the asynchronous implementation of the HTTP FRC.

wdyt ?

> 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.


[jira] Updated: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Janne Siren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Janne Siren updated DIRMINA-666:
--------------------------------

    Description: 
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;
				}



  was:
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.



Updated location of the problem.

> 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.


[jira] Commented: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Janne Siren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678051#action_12678051 ] 

Janne Siren commented on DIRMINA-666:
-------------------------------------

Yes. Typo should have been 0x20 (32)... but as you said it would accept 'm' as replacement of '-', so our quick-and-dirty fix is not good. (Anyhow I am not so worried about accepting illegal header than not accepting legal headers.) 

I am bit confused though from Your comment that RFC uses case sensitive headers for these specific headers. I do not find anywhere statement about that. RFC2616, section 4.2 says: "HTTP header fields, which include general-header (section 4.5), request-header (section 5.3), response-header (section 6.2), and entity-header (section 7.1) fields, follow the same generic format as that given in section 3.1 of RFC 822 [9]. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive." I cannot find anything from section 7.1 that states that these entity-headers are case-sensitive. And in 14.13 I cannot find anything that says that Content-Length field name is case sensitive. But I am very pleased if you can state to which clause in RFC do you refer in your oppinion. If you are correct, I would have to make correction request to Qt-Software department of Nokia (old Trolltech). I most likely will do it anyway, but is it "for better compatibility with broken servers" or "Content-Lenght in POST of QHttp is incompatible with HTTP/1.1 specification" has quite significant meaning to Qt people. 

For your comment "just an example": Well I think that many codes of apache.org has originally been "just an example", but further developped to production quality code. So all feedback should be taken into account. I would not close it or transfer it to other project (it might be copied there if relevant), but tag it as "future developement" or mark it to code "// TODO: These fields should be handled case-insensitive", so that those who relies on quality of examples can easily find what problems are already found from example code. 



> 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.


[jira] Commented: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (DIRMINA-666) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-666:
--------------------------------------

    Fix Version/s: 1.1.8

> 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
>             Fix For: 1.1.8
>
>   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.


[jira] Moved: (ASYNCWEB-26) HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ASYNCWEB-26?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny moved DIRMINA-666 to ASYNCWEB-26:
---------------------------------------------------

        Fix Version/s:     (was: 1.1.8)
          Component/s:     (was: Example)
    Affects Version/s:     (was: 1.1.0)
                  Key: ASYNCWEB-26  (was: DIRMINA-666)
              Project: Asyncweb  (was: MINA)

> HTTP header parsing example incompatible with rfc2616 / content-length field name should be interrepted as case-insensitive
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASYNCWEB-26
>                 URL: https://issues.apache.org/jira/browse/ASYNCWEB-26
>             Project: Asyncweb
>          Issue Type: Bug
>         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.