|
Home > Archive > Perlbal > September 2007 > PATCH: reproxy with multiple urls fails with a 503
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PATCH: reproxy with multiple urls fails with a 503
|
|
| Del Raco 2007-09-26, 1: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
| |
| Brad Fitzpatrick 2007-09-26, 1: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 knows. Yahoo! Answers - Check it out.
> http://answers.yahoo.com/dir/?link=list&sid=396545433
>
| |
| Del Raco 2007-09-27, 1: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->{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 one 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 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 knows. 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.
|
|
|
|
|