Skip to content

Commit

Permalink
fix smart_http bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed Mar 28, 2016
1 parent b4be027 commit 723500a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
5 changes: 1 addition & 4 deletions templates/smart-http/service.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,15 @@
my $s = IO::Select->new($cout, $cerr);
my $buffer_size = $ENV{GITPREP_SMART_HTTP_BUFFER_SIZE};
my $error;
my $output;
my @ready;
my $cb;
$cb = sub {
my $c = shift;
if (@ready = $s->can_read) {
$output = '';
my $output = '';
for my $handle (@ready) {

if (sysread($handle, my $buf, $buffer_size)) {
#warn `ps axuww|grep gitprep` if $k % 3000 == 0;

if ($handle == $cerr) {
$error .= $buf;
}
Expand Down
44 changes: 24 additions & 20 deletions xt/smart_http.t
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,6 @@ note 'Smart HTTP';
$t->content_like(qr/^001e# service=git-upload-pack/);
$t->content_like(qr/multi_ack_detailed/);

# /git-upload-pack
{
my $content = <<EOS;
006fwant 6410316f2ed260666a8a6b9a223ad3c95d7abaed multi_ack_detailed no-done side-band-64k thin-pack ofs-delta
0032want 6410316f2ed260666a8a6b9a223ad3c95d7abaed
00000009done
EOS
$t->post_ok(
'/kimoto/t1.git/git-upload-pack',
{
'Content-Type' => 'application/x-git-upload-pack-request',
'Content-Length' => 174,
'Content' => $content
}
);
$t->status_is(200);
$t->content_type_is('application/x-git-upload-pack-result');
}

# /info/refs recieve-pack request(Basic authentication)
$t->get_ok('/kimoto/t1.git/info/refs?service=git-receive-pack');
$t->status_is(401);
Expand Down Expand Up @@ -135,6 +116,26 @@ EOS
);
$t->status_is(200);
$t->content_type_is('application/x-git-receive-pack-result');

# /git-upload-pack
{
$main::p = 1;
my $content = <<EOS;
006fwant 6410316f2ed260666a8a6b9a223ad3c95d7abaed multi_ack_detailed no-done side-band-64k thin-pack ofs-delta
0032want 6410316f2ed260666a8a6b9a223ad3c95d7abaed
00000009done
EOS
$t->post_ok(
'/kimoto/t1.git/git-upload-pack',
{
'Content-Type' => 'application/x-git-upload-pack-request',
'Content-Length' => 174,
'Content' => $content
}
);
$t->status_is(200);
$t->content_type_is('application/x-git-upload-pack-result');
}
}

note 'Private repository and collaborator';
Expand Down Expand Up @@ -190,7 +191,7 @@ note 'Private repository and collaborator';
}
);
$t->status_is(401);

# Add collaborator
$t->post_ok("/kimoto/t1/settings/collaboration?op=add", form => {collaborator => 'kimoto2'});
$t->content_like(qr/Collaborator kimoto2 is added/);
Expand All @@ -205,3 +206,6 @@ note 'Private repository and collaborator';
$t->header_is("Content-Type", "application/x-git-receive-pack-advertisement");
$t->content_like(qr/^001f# service=git-receive-pack/);
}

# Fix test error(why?)
__END__

0 comments on commit 723500a

Please sign in to comment.