/ Zope / Apsis / Pound Mailing List / Archive / 2009 / 2009-04 / RE: [Pound Mailing List] location headers problems

[ << ] [ >> ]

[ Strange problem with Subversion behind Pound / ... ] [ URGENT|need help in POUND installation / Sunil ... ]

RE: [Pound Mailing List] location headers problems
"SBR" <sbr(at)rlfans.com>
2009-04-12 16:25:35 [ SNIP ]
Hi,

I've just investigated some similar issues I've been having with pound not
rewriting the location when my backend appends its port to the correct
hostname when doing a redirect. I noticed the following if statement in
need_rewrite (svc.c line 742) which seems to have mismatched brackets:

        if(memcmp(&be_addr.sin_addr.s_addr, &in_addr.sin_addr.s_addr,
sizeof(in_addr.sin_addr.s_addr)) == 0
        && (memcmp(&be_addr.sin_port, &in_addr.sin_port,
sizeof(in_addr.sin_port) != 0
            || strcasecmp(proto, (lstn->ctx == NULL)? "http": "https")))) {

The second line is missing a closing bracket after the sizeof so the second
memcmp call is actually:

memcmp(&be_addr.sin_port, &in_addr.sin_port, sizeof(in_addr.sin_port) != 0
|| strcasecmp(proto, (lstn->ctx == NULL)? "http": "https")))

Changing this if to the following fixed the port on my redirects:

        if(memcmp(&be_addr.sin_addr.s_addr, &in_addr.sin_addr.s_addr,
sizeof(in_addr.sin_addr.s_addr)) == 0
        && (memcmp(&be_addr.sin_port, &in_addr.sin_port,
sizeof(in_addr.sin_port)) != 0
            || strcasecmp(proto, (lstn->ctx == NULL)? "http": "https"))) {

It looks like there is a similar issue for IPv6 redirects on line 754.

Regards,
Andrew

-----Original Message-----
From: Dave Steinberg [mailto:dave(at)redterror.net] 
Sent: 20 March 2009 15:04
To: pound(at)apsis.ch
Subject: Re: [Pound Mailing List] location headers problems

>> telnet www.myweb.es 80
>> GET /principal/
>>
>> and I receive location header
>> Location /principal/index.php
>>
>> NO PROBLEM, but if i put
>>
>> telnet www.myweb.es 80
>> GET /principal  (without slash)
>>
>> Location header receibed:
>> Location: http://www.myweb.es:10000/principal/index.php
>>
>> and the client redirect to http://www.myweb.es:10000/principal/index.php
>>
>> I think that rewritelocation 1 solve this problem but dont work,
>> I compiled pound 2.3.2 with this file configuration and work correctly,
the
>> client dont receive the backend port. Why ?
>>
>> I readed CHANGELOG for pound 2.4.4:
>>              -"fixed redirection problem (missing slash in
>> Location/Content-location)"

This sounds like a problem with your backend.  Does the same thing 
happen if you connect directly and issue those same GET commands?


-- 
Dave Steinberg
http://www.geekisp.com/
http://www.steinbergcomputing.com/

--
To unsubscribe send an email with subject unsubscribe to pound(at)apsis.ch.
Please contact roseg(at)apsis.ch for questions.


Re: [Pound Mailing List] location headers problems
Emilio Campos <emilio.campos.martin(at)gmail.com>
2009-04-13 17:47:44 [ SNIP ]
A lot of thanks SBR, I solved this problem downgrade version to 2.3.2 but i
m going to upgrade with this solution

1k thanks ;)

2009/4/12 SBR <sbr(at)rlfans.com>

> Hi,
>
> I've just investigated some similar issues I've been having with pound not
> rewriting the location when my backend appends its port to the correct
> hostname when doing a redirect. I noticed the following if statement in
> need_rewrite (svc.c line 742) which seems to have mismatched brackets:
>
>        if(memcmp(&be_addr.sin_addr.s_addr, &in_addr.sin_addr.s_addr,
> sizeof(in_addr.sin_addr.s_addr)) == 0
>        && (memcmp(&be_addr.sin_port, &in_addr.sin_port,
> sizeof(in_addr.sin_port) != 0
>            || strcasecmp(proto, (lstn->ctx == NULL)? "http": "https")))) {
>
> The second line is missing a closing bracket after the sizeof so the second
> memcmp call is actually:
>
> memcmp(&be_addr.sin_port, &in_addr.sin_port, sizeof(in_addr.sin_port) != 0
> || strcasecmp(proto, (lstn->ctx == NULL)? "http": "https")))
>
> Changing this if to the following fixed the port on my redirects:
>
>        if(memcmp(&be_addr.sin_addr.s_addr, &in_addr.sin_addr.s_addr,
> sizeof(in_addr.sin_addr.s_addr)) == 0
>        && (memcmp(&be_addr.sin_port, &in_addr.sin_port,
> sizeof(in_addr.sin_port)) != 0
>            || strcasecmp(proto, (lstn->ctx == NULL)? "http": "https"))) {
>
> It looks like there is a similar issue for IPv6 redirects on line 754.
>
> Regards,
> Andrew
>
> -----Original Message-----
> From: Dave Steinberg [mailto:dave(at)redterror.net]
> Sent: 20 March 2009 15:04
> To: pound(at)apsis.ch
> Subject: Re: [Pound Mailing List] location headers problems
>
> >> telnet www.myweb.es 80
> >> GET /principal/
> >>
> >> and I receive location header
> >> Location /principal/index.php
> >>
> >> NO PROBLEM, but if i put
> >>
> >> telnet www.myweb.es 80
> >> GET /principal  (without slash)
> >>
> >> Location header receibed:
> >> Location: http://www.myweb.es:10000/principal/index.php
> >>
> >> and the client redirect to
> http://www.myweb.es:10000/principal/index.php
> >>
> >> I think that rewritelocation 1 solve this problem but dont work,
> >> I compiled pound 2.3.2 with this file configuration and work correctly,
> the
> >> client dont receive the backend port. Why ?
> >>
> >> I readed CHANGELOG for pound 2.4.4:
> >>              -"fixed redirection problem (missing slash in
> >> Location/Content-location)"
>
> This sounds like a problem with your backend.  Does the same thing
> happen if you connect directly and issue those same GET commands?
>
>
> --
> Dave Steinberg
> http://www.geekisp.com/
> http://www.steinbergcomputing.com/
>
> --
> To unsubscribe send an email with subject unsubscribe to pound(at)apsis.ch.
> Please contact roseg(at)apsis.ch for questions.
>
>
> --
> To unsubscribe send an email with subject unsubscribe to pound(at)apsis.ch.
> Please contact roseg(at)apsis.ch for questions.
>

Attachments:  
text.html text/html 4062 Bytes

MailBoxer