Permalink
Browse files

Prevent cURL and possibley ourselves from sending Continue headers. (…

…closes #51)
  • Loading branch information...
1 parent 3c3fade commit 5fa6ba963b3afcfb4b48fd4049a83c1b507cdc7d @sbisbee committed Jul 31, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −0 src/Sag.php
  2. +0 −1 tests/SagTest.php
View
@@ -1049,6 +1049,18 @@ private function procPacket($method, $url, $data = null, $headers = array()) {
$url = $this->pathPrefix . $url;
}
+ // Filter the use of the Expect header since we don't support Continue headers.
+ if(strtolower($headers['expect']) === '100-continue' || strtolower($headers['Expect']) === '100-continue') {
+ throw new SagException('Sag does not support HTTP/1.1\'s Continue.');
+ }
+ else if(!$headers['expect'] && !$headers['Expect']) {
+ /*
+ * PHP cURL will set the Expect header to 100-continue if we don't set it
+ * ourselves. See https://github.com/sbisbee/sag/pull/51
+ */
+ $headers['Expect'] = ' '; //1 char string, so it's == to true
+ }
+
// Do some string replacing for HTTP sanity.
$url = str_replace(array(" ", "\""), array('%20', '%22'), $url);
View
@@ -884,5 +884,4 @@ public function test_connectionFailure() {
$this->assertTrue(true);
}
}
-
}

0 comments on commit 5fa6ba9

Please sign in to comment.