Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F91676
D7798.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7798.diff
View Options
diff --git a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
--- a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
+++ b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
@@ -75,6 +75,10 @@
}
} else if ($this->state == 'bytes') {
$new_data = substr($this->buffer, 0, $this->expectBytes);
+ if (!strlen($new_data)) {
+ // No more bytes available yet, wait for more data.
+ break;
+ }
$this->buffer = substr($this->buffer, strlen($new_data));
$this->expectBytes -= strlen($new_data);
diff --git a/src/applications/diffusion/protocol/__tests__/DiffusionSubversionWireProtocolTestCase.php b/src/applications/diffusion/protocol/__tests__/DiffusionSubversionWireProtocolTestCase.php
--- a/src/applications/diffusion/protocol/__tests__/DiffusionSubversionWireProtocolTestCase.php
+++ b/src/applications/diffusion/protocol/__tests__/DiffusionSubversionWireProtocolTestCase.php
@@ -61,6 +61,31 @@
));
}
+ public function testSubversionWireProtocolPartialFrame() {
+ $proto = new DiffusionSubversionWireProtocol();
+
+ // This is primarily a test that we don't hang when we write() a frame
+ // which straddles a string boundary.
+ $msg1 = $proto->writeData('( duck 5:qu');
+ $msg2 = $proto->writeData('ack ) ');
+
+ $this->assertEqual(array(), ipull($msg1, 'structure'));
+ $this->assertEqual(
+ array(
+ array(
+ array(
+ 'type' => 'word',
+ 'value' => 'duck',
+ ),
+ array(
+ 'type'=> 'string',
+ 'value' => 'quack',
+ ),
+ ),
+ ),
+ ipull($msg2, 'structure'));
+ }
+
private function assertSameSubversionMessages($string, array $structs) {
$proto = new DiffusionSubversionWireProtocol();
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/at/bq/jbbb52d3f5okei4a
Default Alt Text
D7798.diff (1 KB)
Attached To
Mode
D7798: Fix loop in svnserve workflow for large binaries
Attached
Detach File
Event Timeline
Log In to Comment