Showing 1 changed files with 11 additions and 11 deletions
+11 -11
templates/smart-http/service.html.ep
... ...
@@ -16,22 +16,22 @@
16 16
   my @cmd = $git->cmd($user, $project, $service, '--stateless-rpc', $rep_dir);
17 17
   
18 18
   # Body
19
-  my $body = $self->req->body;
20
-  if (($self->req->headers->content_encoding || '') =~ /^(?:x-)?gzip$/) {
21
-     my $success = IO::Uncompress::Gunzip::gunzip(\$body);
22
-     unless ($success) {
23
-       $self->render_exception("gunzip failed: $IO::Uncompress::Gunzip::GunzipError\n");
24
-       return;
25
-     }
26
-  }
27
-  warn $body;
19
+  my $content = $self->req->content;
28 20
   
29 21
   # Read
30 22
   my ($cout, $cerr) = (Symbol::gensym, Symbol::gensym);
31 23
   my $pid = IPC::Open3::open3(my $cin, $cout, $cerr, @cmd);
32
-  print $cin $body;
24
+  my $pos = 0;
25
+  while (1) {
26
+    my $chunk = $content->get_body_chunk($pos);
27
+    last unless defined $chunk;
28
+    my $length = length $chunk;
29
+    last unless $length;
30
+
31
+    print $cin $chunk;
32
+    $pos += $length;
33
+  }
33 34
   close $cin;
34
-  $body = undef;
35 35
   
36 36
   # Response
37 37
   $self->res->headers->content_type("application/x-git-$service-result");