Hi,
I identified a problem when accessing a remote OBS instance through a
squid proxy. The change
commit 5ed45e0096ff5051827c251c8fd384dd70debcbb
Author: Michael Schroeder
Date: Wed May 26 11:26:55 2010 +0200
- handoff remote source requests to ajax server
- make request data available
diff --git a/src/backend/BSServer.pm b/src/backend/BSServer.pm
index 154b965..afead0f 100644
--- a/src/backend/BSServer.pm
+++ b/src/backend/BSServer.pm
@@ -44,6 +44,7 @@ use BSHTTP;
use strict;
# FIXME: store in request and make request available
+our $request;
our $peer;
our $peerport;
our $slot;
@@ -824,6 +825,7 @@ sub compile_dispatches {
sub dispatch {
my ($conf, $req) = @_;
+ $BSServer::request = $req;
my $disps = $conf->{'dispatches'};
my $stdreply = $conf->{'stdreply'};
die("500 no dispatches configured\n") unless $disps;
diff --git a/src/backend/bs_srcserver b/src/backend/bs_srcserver
index 3364355..daf6662 100755
--- a/src/backend/bs_srcserver
+++ b/src/backend/bs_srcserver
@@ -2814,9 +2814,17 @@ sub getfile {
die("404 $filename: no such file\n") unless $files->{$filename};
my @s = repstat($rev, $filename, $files->{$filename});
die("$projid/$packid/$files->{$filename}-$filename: $!\n") unless @s;
- local *F;
- repopen($rev, $filename, $files->{$filename}, \*F) ||
die("$projid/$packid/$files->{$filename}-$filename: $!\n");
- BSServer::reply_file(\*F);
+ if (!$BSStdServer::isajax && $rev->{'srcmd5'} && $rev->{'srcmd5'}
ne 'upload' && $rev->{'srcmd5'} ne 'pattern' && $rev->{'srcmd5'} ne
'empty') {
+ # hack: we identify remote source downloads by looking at the user agent
+ my $useragent = $BSServer::request->{'headers'}->{'user-agent'} || '';
+ if ($useragent =~ /BSRPC/) {
+ BSHandoff::handoff($ajaxsocket,
"/source/$projid/$packid/$filename", undef, "rev=$rev->{'srcmd5'}");
+ exit(0);
+ }
+ }
+ my $fd = gensym;
+ repopen($rev, $filename, $files->{$filename}, $fd) ||
die("$projid/$packid/$files->{$filename}-$filename: $!\n");
+ BSWatcher::reply_file($fd);
return undef;
}
@@ -4980,6 +4988,7 @@ my $dispatches_ajax = [
'/getbinaries $project $repository $arch binaries: nometa:bool?
raw:bool?' => \&worker_getbinaries,
'/lastevents $filter:* start:num? obsname:?' => \&worker_lastevents,
'/source/$project/$package rev' => \&getfilelist_ajax,
+ '/source/$project/$package:package_pattern/$filename rev?' => \&getfile,
];
####################################################################
causes special handling if the user-agent string indicates that the
other system is an OBS system as well, resulting in using chunked
transfer encoding instead of having the content length. When this
passes through the squid proxy the chunked transfer encoding is
replaces by "normal" encoding but still the content-length not added.
The receiving OBS cannot deal with that situation.
Thus my question is, why was this special handling introduced and what
would be the consequences if I disabled that? Is this just a
performance downgrade or would that also have an impact on
functionality.
Robert
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org
To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org