PATCH: reproxy with multiple urls fails with a 503
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Perlbal > PATCH: reproxy with multiple urls fails with a 503




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    PATCH: reproxy with multiple urls fails with a 503  
Del Raco


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-07 06:12 AM

Hi,

This seems to occur when reproxy is passed with an
even number of URLs, and the odd ones are 404'ing.  It
appears that ClientProxy.pm's use_reproxy_backend() is
doing an unnecessary shift.

Here're some patches for Perlbal 1.59.

diff -uw ClientProxy.pm.orig ClientProxy.pm
--- ClientProxy.pm.orig 2007-09-25 20:17:12.000000000
-0700
+++ ClientProxy.pm      2007-09-25 20:17:19.000000000
-0700
@@ -216,7 +216,7 @@
my Perlbal::BackendHTTP $be =3D $_[1];
=20
# get a URI
-    my $datref =3D $self->{currently_reproxying} =3D
shift @{$self->{reproxy_uris}};
+    my $datref =3D $self->{currently_reproxying} =3D
$self->{reproxy_uris}->[0];
unless (defined $datref) {
# return error and close the backend
$be->close('invalid_uris');


diff -uw 35-reproxy.t.orig 35-reproxy.t
--- 35-reproxy.t.orig   2007-09-25 20:06:06.000000000
-0700
+++ 35-reproxy.t        2007-09-25 20:07:16.000000000
-0700
@@ -132,6 +132,7 @@
=20
# try to reproxy to a list of URLs, where the first
one is bogus, and last one is good
ok_reproxy_url_list();
+ok_reproxy_url_list2();
=20
# responses to HEAD requests should not have a body
{
@@ -154,6 +155,11 @@
ok($resp->content eq $file_content, "reproxy URL
w/ dead one first");
}
=20
+sub ok_reproxy_url_list2 {
+    my $resp =3D
$wc->request("reproxy_url:http://127.0.0.1:$webport/baz.txt
http://127.0.0.1:$webport/foo.txt");
+    ok($resp->content eq $file_content, "reproxy URL
w/ 404 first");
+}
+
sub ok_reproxy_file {
my $resp =3D
$wc->request("reproxy_file:$dir/foo.txt");
ok($resp && $resp->content eq $file_content,
"reproxy file");


=20
 ________________________________________
_________________________________=
___________
Yahoo! oneSearch: Finally, mobile search=20
that gives answers, not web links.=20
http://mobile.yahoo.com/mobileweb/o...?refer=3D1ONXIC


=20
 ________________________________________
_________________________________=
___________
Be a better Heartthrob. Get better relationship answers from someone who =
knows. Yahoo! Answers - Check it out.=20
http://answers.yahoo.com/dir/?link=...sid=3D396545433






[ Post a follow-up to this message ]



    Re: PATCH: reproxy with multiple urls fails with a 503  
Brad Fitzpatrick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-07 06:12 AM

I love that you pasted this patch inline, not as an attachment, but
unfortunately your MUA isn't setup right and mangled the patch by trying
to wordwrap it and otherwise mucking up the whitespace.

Worst case, attach it.


On Tue, 25 Sep 2007, Del Raco wrote:

> Hi,
>
> This seems to occur when reproxy is passed with an
> even number of URLs, and the odd ones are 404'ing.  It
> appears that ClientProxy.pm's use_reproxy_backend() is
> doing an unnecessary shift.
>
> Here're some patches for Perlbal 1.59.
>
> diff -uw ClientProxy.pm.orig ClientProxy.pm
> --- ClientProxy.pm.orig 2007-09-25 20:17:12.000000000
> -0700
> +++ ClientProxy.pm      2007-09-25 20:17:19.000000000
> -0700
> @@ -216,7 +216,7 @@
>      my Perlbal::BackendHTTP $be = $_[1];
>
>      # get a URI
> -    my $datref = $self->{currently_reproxying} =
> shift @{$self->{reproxy_uris}};
> +    my $datref = $self->{currently_reproxying} =
> $self->{reproxy_uris}->[0];
>      unless (defined $datref) {
>          # return error and close the backend
>          $be->close('invalid_uris');
>
>
> diff -uw 35-reproxy.t.orig 35-reproxy.t
> --- 35-reproxy.t.orig   2007-09-25 20:06:06.000000000
> -0700
> +++ 35-reproxy.t        2007-09-25 20:07:16.000000000
> -0700
> @@ -132,6 +132,7 @@
>
>  # try to reproxy to a list of URLs, where the first
> one is bogus, and last one is good
>  ok_reproxy_url_list();
> +ok_reproxy_url_list2();
>
>  # responses to HEAD requests should not have a body
>  {
> @@ -154,6 +155,11 @@
>      ok($resp->content eq $file_content, "reproxy URL
> w/ dead one first");
>  }
>
> +sub ok_reproxy_url_list2 {
> +    my $resp =
> $wc->request("reproxy_url:http://127.0.0.1:$webport/baz.txt
> http://127.0.0.1:$webport/foo.txt");
> +    ok($resp->content eq $file_content, "reproxy URL
> w/ 404 first");
> +}
> +
>  sub ok_reproxy_file {
>      my $resp =
> $wc->request("reproxy_file:$dir/foo.txt");
>      ok($resp && $resp->content eq $file_content,
> "reproxy file");
>
>
>
>  ________________________________________
__________________________________
__________
> Yahoo! oneSearch: Finally, mobile search
> that gives answers, not web links.
> http://mobile.yahoo.com/mobileweb/o...ch?refer=1ONXIC
>
>
>
>  ________________________________________
__________________________________
__________
> Be a better Heartthrob. Get better relationship answers from someone who k
nows. Yahoo! Answers - Check it out.
> http://answers.yahoo.com/dir/?link=list&sid=396545433
>






[ Post a follow-up to this message ]



    Re: PATCH: reproxy with multiple urls fails with a 503  
Del Raco


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-27-07 06:11 AM

My apologies.  Try #2.

I've attached the diffs just in case.

 ========================================
====================================
============
--- ClientProxy.pm.orig 2007-09-26 20:50:00.000000000 -0700
+++ ClientProxy.pm      2007-09-26 20:50:31.000000000 -0700
@@ -216,7 +216,7 @@
my Perlbal::BackendHTTP $be = $_[1];

# get a URI
-    my $datref = $self->{currently_reproxying} = shift @{$self->&
#123;reproxy_uris}};
+    my $datref = $self->{currently_reproxying} = $self->{reproxy_
uris}->[0];
unless (defined $datref) {
# return error and close the backend
$be->close('invalid_uris');

 ========================================
====================================
============
--- 35-reproxy.t.orig   2007-09-26 20:51:11.000000000 -0700
+++ 35-reproxy.t        2007-09-26 20:53:22.000000000 -0700
@@ -133,6 +133,9 @@
# try to reproxy to a list of URLs, where the first one is bogus, and last o
ne is good
ok_reproxy_url_list();

+# try to reproxy to a list of URLs, where the first one is a 404, and last 
one is good
+ok_reproxy_url_list_404();
+
# responses to HEAD requests should not have a body
{
$wc->keepalive(0);
@@ -154,6 +157,11 @@
ok($resp->content eq $file_content, "reproxy URL w/ dead one first");
}

+sub ok_reproxy_url_list_404 {
+    my $resp = $wc->request("reproxy_url:http://127.0.0.1:$webport/baz..txt http:
//127.0.0.1:$webport/foo.txt");
+    ok($resp->content eq $file_content, "reproxy URL w/ 404 one first");
+}
+
sub ok_reproxy_file {
my $resp = $wc->request("reproxy_file:$dir/foo.txt");
ok($resp && $resp->content eq $file_content, "reproxy file");

Brad Fitzpatrick <brad@danga.com> wrote: I love that you pasted this patch i
nline, not as an attachment, but
unfortunately your MUA isn't setup right and mangled the patch by trying
to wordwrap it and otherwise mucking up the whitespace.

Worst case, attach it.


On Tue, 25 Sep 2007, Del Raco wrote:

> Hi,
>
> This seems to occur when reproxy is passed with an
> even number of URLs, and the odd ones are 404'ing.  It
> appears that ClientProxy.pm's use_reproxy_backend() is
> doing an unnecessary shift.
>
> Here're some patches for Perlbal 1.59.
>
> diff -uw ClientProxy.pm.orig ClientProxy.pm
> --- ClientProxy.pm.orig 2007-09-25 20:17:12.000000000
> -0700
> +++ ClientProxy.pm      2007-09-25 20:17:19.000000000
> -0700
> @@ -216,7 +216,7 @@
>      my Perlbal::BackendHTTP $be = $_[1];
>
>      # get a URI
> -    my $datref = $self->{currently_reproxying} =
> shift @{$self->{reproxy_uris}};
> +    my $datref = $self->{currently_reproxying} =
> $self->{reproxy_uris}->[0];
>      unless (defined $datref) {
>          # return error and close the backend
>          $be->close('invalid_uris');
>
>
> diff -uw 35-reproxy.t.orig 35-reproxy.t
> --- 35-reproxy.t.orig   2007-09-25 20:06:06.000000000
> -0700
> +++ 35-reproxy.t        2007-09-25 20:07:16.000000000
> -0700
> @@ -132,6 +132,7 @@
>
>  # try to reproxy to a list of URLs, where the first
> one is bogus, and last one is good
>  ok_reproxy_url_list();
> +ok_reproxy_url_list2();
>
>  # responses to HEAD requests should not have a body
>  {
> @@ -154,6 +155,11 @@
>      ok($resp->content eq $file_content, "reproxy URL
> w/ dead one first");
>  }
>
> +sub ok_reproxy_url_list2 {
> +    my $resp =
> $wc->request("reproxy_url:http://127.0.0.1:$webport/baz.txt
> http://127.0.0.1:$webport/foo.txt");
> +    ok($resp->content eq $file_content, "reproxy URL
> w/ 404 first");
> +}
> +
>  sub ok_reproxy_file {
>      my $resp =
> $wc->request("reproxy_file:$dir/foo.txt");
>      ok($resp && $resp->content eq $file_content,
> "reproxy file");
>
>
>
>  ________________________________________
__________________________________
__________
> Yahoo! oneSearch: Finally, mobile search
> that gives answers, not web links.
> http://mobile.yahoo.com/mobileweb/o...ch?refer=1ONXIC
>
>
>
>  ________________________________________
__________________________________
__________
> Be a better Heartthrob. Get better relationship answers from someone who k
nows. Yahoo! Answers - Check it out.
> http://answers.yahoo.com/dir/?link=list&sid=396545433
>


 
---------------------------------
Tonight's top picks. What will you watch tonight? Preview the hottest shows 
on Yahoo! TV.    





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:44 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register