RE: mode tcp with mode http/shoutcast radio issue

2011-03-11 Thread Florescu, Dan Alexandru
This worked.
Thanks for the help Willy.


-Original Message-
From: Willy Tarreau []
Sent: Friday 11, March 03, 2011 10:39
To: Florescu, Dan Alexandru
Cc: haproxy@formilux.org
Subject: Re: mode tcp with mode http/shoutcast radio issue

On Wed, Mar 09, 2011 at 04:41:49PM +0200, Florescu, Dan Alexandru wrote:
> This works. Problem is that I cannot use acl's  like the following:
> hdr(User-Agent) -i WinampMPEG/5.60
> hdr(Host) -i 80.86.106.35
>
> I guess this is because it receives the tcp stream and doen't analyze headers 
> anymore.

If the requests are enough HTTP compliant, then you might be able to
use the above in TCP mode provided you wait for a complete HTTP request.
It works like this :

   acl winamp hdr(User-Agent) -i WinampMPEG/5.60
   tcp-request inspect-delay 5s
   tcp-request content accept if HTTP
   use-backend XXX if winamp ...

The idea is that the "tcp-request accept" ACL will wait until the
contents parse as a valid HTTP request (at most 5s). Once this is
OK, the ACLs relying on headers will be able to match.

Regards,
Willy


The information contained herein is intended for its addressee(s) only and it 
is privileged or otherwise confidential. Any unauthorized distribution, 
amendment or disclosure hereof is strictly forbidden by the law. Please find 
complete and translated versions at http://www.rompetrol.com/disclaimer.html



Re: mode tcp with mode http/shoutcast radio issue

2011-03-11 Thread Willy Tarreau
On Wed, Mar 09, 2011 at 04:41:49PM +0200, Florescu, Dan Alexandru wrote:
> This works. Problem is that I cannot use acl's  like the following:
> hdr(User-Agent) -i WinampMPEG/5.60
> hdr(Host) -i 80.86.106.35
> 
> I guess this is because it receives the tcp stream and doen't analyze headers 
> anymore.

If the requests are enough HTTP compliant, then you might be able to
use the above in TCP mode provided you wait for a complete HTTP request.
It works like this :

   acl winamp hdr(User-Agent) -i WinampMPEG/5.60
   tcp-request inspect-delay 5s
   tcp-request accept if HTTP
   use-backend XXX if winamp ...

The idea is that the "tcp-request accept" ACL will wait until the
contents parse as a valid HTTP request (at most 5s). Once this is
OK, the ACLs relying on headers will be able to match.

Regards,
Willy