Showing 2 changed files with 23 additions and 25 deletions
+3 -6
templates/smart-http/service.html.ep
... ...
@@ -42,24 +42,21 @@
42 42
   $cb = sub {
43 43
     my $c = shift;
44 44
     if (@ready = $s->can_read) {
45
-      $output = '';
46 45
       for my $handle (@ready) {
47 46
         
48 47
         if (sysread($handle, my $buf, $buffer_size)) {
49
-          #warn `ps axuww|grep gitprep` if $k % 3000 == 0;
50
-          
51 48
           if ($handle == $cerr) {
52
-            $error .= $buf;
49
+            $error .= $buf if defined $buf;
53 50
           }
54 51
           else {
55
-            $output .= $buf;
52
+            $output .= $buf if defined $buf;
56 53
           }
57 54
         }
58 55
         else {
59 56
           $s->remove($handle);
60 57
         }
61 58
       }
62
-      $c->write_chunk($output, $cb);
59
+      $c->write_chunk($output, $cb) if defined $output;
63 60
     }
64 61
     else {
65 62
       $c->finish;
+20 -19
xt/smart_http.t
... ...
@@ -89,25 +89,6 @@ 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
-
111 92
   # /info/refs recieve-pack request(Basic authentication)
112 93
   $t->get_ok('/kimoto/t1.git/info/refs?service=git-receive-pack');
113 94
   $t->status_is(401);
... ...
@@ -135,6 +116,26 @@ EOS
135 116
   );
136 117
   $t->status_is(200);
137 118
   $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
+  }
138 139
 }
139 140
 
140 141
 note 'Private repository and collaborator';