Showing 2 changed files with 25 additions and 23 deletions
+6 -3
templates/smart-http/service.html.ep
... ...
@@ -42,21 +42,24 @@
42 42
   $cb = sub {
43 43
     my $c = shift;
44 44
     if (@ready = $s->can_read) {
45
+      $output = '';
45 46
       for my $handle (@ready) {
46 47
         
47 48
         if (sysread($handle, my $buf, $buffer_size)) {
49
+          #warn `ps axuww|grep gitprep` if $k % 3000 == 0;
50
+          
48 51
           if ($handle == $cerr) {
49
-            $error .= $buf if defined $buf;
52
+            $error .= $buf;
50 53
           }
51 54
           else {
52
-            $output .= $buf if defined $buf;
55
+            $output .= $buf;
53 56
           }
54 57
         }
55 58
         else {
56 59
           $s->remove($handle);
57 60
         }
58 61
       }
59
-      $c->write_chunk($output, $cb) if defined $output;
62
+      $c->write_chunk($output, $cb);
60 63
     }
61 64
     else {
62 65
       $c->finish;
+19 -20
xt/smart_http.t
... ...
@@ -89,6 +89,25 @@ note 'Smart HTTP';
89 89
   $t->content_like(qr/^001e# service=git-upload-pack/);
90 90
   $t->content_like(qr/multi_ack_detailed/);
91 91
   
92
+  # /git-upload-pack
93
+  {
94
+    my $content = <<EOS;
95
+006fwant 6410316f2ed260666a8a6b9a223ad3c95d7abaed multi_ack_detailed no-done side-band-64k thin-pack ofs-delta
96
+0032want 6410316f2ed260666a8a6b9a223ad3c95d7abaed
97
+00000009done
98
+EOS
99
+    $t->post_ok(
100
+      '/kimoto/t1.git/git-upload-pack',
101
+      {
102
+        'Content-Type' => 'application/x-git-upload-pack-request',
103
+        'Content-Length' => 174,
104
+        'Content'        => $content
105
+      }
106
+    );
107
+    $t->status_is(200);
108
+    $t->content_type_is('application/x-git-upload-pack-result');
109
+  }
110
+
92 111
   # /info/refs recieve-pack request(Basic authentication)
93 112
   $t->get_ok('/kimoto/t1.git/info/refs?service=git-receive-pack');
94 113
   $t->status_is(401);
... ...
@@ -116,26 +135,6 @@ note 'Smart HTTP';
116 135
   );
117 136
   $t->status_is(200);
118 137
   $t->content_type_is('application/x-git-receive-pack-result');
119
-
120
-  # /git-upload-pack
121
-  {
122
-    $main::ppp = 1;
123
-    my $content = <<EOS;
124
-006fwant 6410316f2ed260666a8a6b9a223ad3c95d7abaed multi_ack_detailed no-done side-band-64k thin-pack ofs-delta
125
-0032want 6410316f2ed260666a8a6b9a223ad3c95d7abaed
126
-00000009done
127
-EOS
128
-    $t->post_ok(
129
-      '/kimoto/t1.git/git-upload-pack',
130
-      {
131
-        'Content-Type' => 'application/x-git-upload-pack-request',
132
-        'Content-Length' => 174,
133
-        'Content'        => $content
134
-      }
135
-    );
136
-    $t->status_is(200);
137
-    $t->content_type_is('application/x-git-upload-pack-result');
138
-  }
139 138
 }
140 139
 
141 140
 note 'Private repository and collaborator';