... | ... |
@@ -10,7 +10,6 @@ use Encode qw/encode decode/; |
10 | 10 |
use Gitprep::API; |
11 | 11 |
use Gitprep::Git; |
12 | 12 |
use Gitprep::Manager; |
13 |
-use Gitprep::SmartHTTP; |
|
14 | 13 |
use Scalar::Util 'weaken'; |
15 | 14 |
use Validator::Custom; |
16 | 15 |
|
... | ... |
@@ -26,7 +25,6 @@ has 'dbi'; |
26 | 25 |
has 'git'; |
27 | 26 |
has 'manager'; |
28 | 27 |
has 'validator'; |
29 |
-has 'smart_http'; |
|
30 | 28 |
|
31 | 29 |
use constant BUFFER_SIZE => 8192; |
32 | 30 |
|
... | ... |
@@ -221,9 +219,6 @@ sub startup { |
221 | 219 |
} |
222 | 220 |
}); |
223 | 221 |
|
224 |
- my $sh = Gitprep::SmartHTTP->new; |
|
225 |
- $self->smart_http($sh); |
|
226 |
- |
|
227 | 222 |
# /info/refs |
228 | 223 |
$r->get('/info/refs' => template 'smart-http/info-refs'); |
229 | 224 |
|
... | ... |
@@ -322,6 +317,9 @@ sub startup { |
322 | 317 |
}); |
323 | 318 |
} |
324 | 319 |
} |
320 |
+ |
|
321 |
+ # Smart HTTP Buffer size |
|
322 |
+ $ENV{GITPREP_SMART_HTTP_BUFFER_SIZE} ||= 8192; |
|
325 | 323 |
} |
326 | 324 |
|
327 | 325 |
1; |
... | ... |
@@ -1,7 +0,0 @@ |
1 |
-package Gitprep::SmartHTTP; |
|
2 |
- |
|
3 |
-use Mojo::Base -base; |
|
4 |
- |
|
5 |
-has buffer_size => 8192; |
|
6 |
- |
|
7 |
-1; |
... | ... |
@@ -7,7 +7,6 @@ |
7 | 7 |
my $user = param('user'); |
8 | 8 |
my $project = param('project'); |
9 | 9 |
my $git = app->git; |
10 |
- my $sh = app->smart_http; |
|
11 | 10 |
|
12 | 11 |
# Smart HTTP |
13 | 12 |
if ($service eq 'git-upload-pack' || $service eq 'git-receive-pack') { |
... | ... |
@@ -23,10 +22,10 @@ |
23 | 22 |
close $cin; |
24 | 23 |
my ( $refs, $err, $buf ) = ( '', '', '' ); |
25 | 24 |
my $s = IO::Select->new($cout, $cerr); |
26 |
- my $buffer_size = $sh->buffer_size; |
|
25 |
+ my $buffer_size = $ENV{GITPREP_SMART_HTTP_BUFFER_SIZE}; |
|
27 | 26 |
while (my @ready = $s->can_read) { |
28 | 27 |
for my $handle (@ready) { |
29 |
- while (sysread($handle, $buf,$buffer_size)) { |
|
28 |
+ while (sysread($handle, $buf, $buffer_size)) { |
|
30 | 29 |
if ($handle == $cerr) { |
31 | 30 |
$err .= $buf; |
32 | 31 |
} |
... | ... |
@@ -3,8 +3,6 @@ |
3 | 3 |
use Symbol (); |
4 | 4 |
use IO::Select (); |
5 | 5 |
|
6 |
- my $sh = app->smart_http; |
|
7 |
- |
|
8 | 6 |
my $service = param('service'); |
9 | 7 |
my $user = param('user'); |
10 | 8 |
my $project = param('project'); |
... | ... |
@@ -37,7 +35,7 @@ |
37 | 35 |
# Write |
38 | 36 |
my $buf = ''; |
39 | 37 |
my $s = IO::Select->new($cout, $cerr); |
40 |
- my $buffer_size = $sh->buffer_size; |
|
38 |
+ my $buffer_size = $ENV{GITPREP_SMART_HTTP_BUFFER_SIZE}; |
|
41 | 39 |
my $cb; |
42 | 40 |
$cb = sub { |
43 | 41 |
my $c = shift; |