HAProxy responds with bad request when cookie header is incorrect.

From: Sreekanth V <sreeix#gmail.com>
Date: Mon, 26 Dec 2011 23:23:37 +0530


HI,

We have been facing a strange issue when we moved to HAProxy based load balancing system, instead of just using the nginx.

Our Android app sends a request to the server that has something like this for the headers( It's a bug in our code)

POST /android/session

charset: utf-8<CRLF>
accept-encoding: gzip, deflate <CRLF>
cookie <CRLF>
User-Agent: Dalvik... <CRLF>

<CRLF><CRLF>

Notice the Lack of colon after cookie.

It used to work fine till we were posting to nginx, because i guess nginix was ignoring the cookie and moving on to other headers But we now have HAProxy fronting a set of nginx servers, and we are noticing HAProxy return 400 Bad Request on this. Some basic digging into the code it looks like it is expecting a colon and value after the cookie, if it does not find it it sets up a bad response. So should HAProxy not ignore the missing colon and continue parsing the headers till <CRLF><CRLF> is found.

I am sure above header does not follow the standard spec,most other parsers also barf for the above headers, but would the implementation be better if it is forgiving of the malformed headers. Anybody has had similar issues?

The reason I'd like to make a patch in HAProxy is that we have old version of andriod apps floating on the internet, and even if we fix the bug in the new app, older versions will not work.

Thoughts?

Cheers
sreekanth Received on 2011/12/26 18:53

This archive was generated by hypermail 2.2.0 : 2011/12/26 19:00 CET