users@grizzly.java.net

Re: Duplicate Content-Length headers

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Wed, 09 Dec 2009 11:22:25 +0100

Hi Adrian,

can you pls. show Grizzly initialization code?

WBR,
Alexey.


On Dec 8, 2009, at 11:20 , adrian.p.smith_at_bt.com wrote:

> Hubert,
>
> Here is a simple unit test to run against a running server.
>
> @Test
> public void testDoubleContentLengthHeaders() throws Exception {
> HttpClient httpClient = new HttpClient();
> PutMethod putMethod = new PutMethod("http://localhost:9090");
> putMethod.addRequestHeader("Content-Length", "0");
> putMethod.addRequestHeader("content-length", "0");
>
> int rc = httpClient.executeMethod(putMethod);
> System.out.println(rc);
>
> assertFalse(400 == rc);
> }
>
> I think the Grizzly code in question is somewhere around
> com.sun.grizzly.util.http.MimeHeaders.java
>
> /**
> * Finds and returns a unique header field with the given name. If
> no such
> * field exists, null is returned. If the specified header field is
> not
> * unique then an {_at_link IllegalArgumentException} is thrown.
> */
> public MessageBytes getUniqueValue(String name) {
> MessageBytes result = null;
> for (int i = 0; i < count; i++) {
> if (headers[i].getName().equalsIgnoreCase(name)) {
> if (result == null) {
> result = headers[i].getValue();
> } else {
> throw new IllegalArgumentException();
> }
> }
> }
> return result;
> }
>
>
> Which results in a 400 BAD_REQUEST response?
>
> Does this make sense?
>
> Regards,
>
> Adrian
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Hubert Iwaniuk [mailto:neotyk_at_kungfoo.pl]
> Sent: 08 December 2009 09:32
> To: users_at_grizzly.dev.java.net
> Subject: Re: Duplicate Content-Length headers
>
> Hi Adrian,
>
> Can you provide a sample to reproduce this issue.
>
> Thanks,
> Hubert
>
>
>
> On Tue, Dec 8, 2009 at 9:36 AM, <adrian.p.smith_at_bt.com> wrote:
>> I notice that Grizzly rejects requests with more than one
> Content-Length
>>
>> header.
>>
>>
>>
>> I understand why this is done, but could the team consider an
>>
>> alternative strategy?
>>
>>
>>
>> Could the server be made to accept these requests, providing the
> values
>>
>> for content-length are identical?
>>
>>
>>
>> I have some legacy clients that I cannot change and this is making it
>>
>> hard for me to choose Grizzly as my prefered server.
>>
>>
>>
>> TIA.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>