Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Fixes to the continuousQuery method."

This reverts commit 597246a.
  • Loading branch information...
commit 49d0bec8b798bdd642a5a60265ab49add1234e89 1 parent 597246a
minion authored
Showing with 7 additions and 17 deletions.
  1. +7 −17 lib/couch.php
View
24 lib/couch.php 100755 → 100644
@@ -221,23 +221,20 @@ public function storeAsFile($url,$data,$content_type) {
public function continuousQuery($callable,$method,$url,$parameters = array(),$data = null) {
if ( !in_array($method, $this->HTTP_METHODS ) )
throw new Exception("Bad HTTP method: $method");
- if ( !is_callable($callable) )
+ if ( !is_callable($callable) )
throw new InvalidArgumentException("callable argument have to success to is_callable PHP function");
if ( is_array($parameters) AND count($parameters) )
$url = $url.'?'.http_build_query($parameters);
- //Send the request to the socket
- $request = $this->_socket_buildRequest($method,$url,$data,null);
+
+ $request = $this->_socket_buildRequest($method,$url,$data);
if ( !$this->_connect() ) return FALSE;
fwrite($this->socket, $request);
-
- //Read the headers and check that the response is valid
- $response = '';
+ $response = '';
$code=0;
$headers = false;
while (!feof($this->socket)&& !$headers) {
$response.=fgets($this->socket);
- if ($response == "HTTP/1.1 100 Continue\r\n\r\n") { $response = ''; continue; } //Ignore 'continue' headers, they will be followed by the real header.
- elseif (preg_match("/\r\n\r\n$/",$response) ) {
+ if (preg_match("/\r\n\r\n$/",$response) ) {
$headers = true;
}
}
@@ -245,16 +242,9 @@ public function continuousQuery($callable,$method,$url,$parameters = array(),$da
$split=explode(" ",trim(reset($headers)));
$code = $split[1];
unset($split);
- //If an invalid response is sent, read the rest of the response and throw an appropriate couchException
- if (!in_array($code,array(200,201))) {
- stream_set_blocking($this->socket,false);
- $response .= stream_get_contents($this->socket);
- fclose($this->socket);
- throw couchException::factory($response, $method, $url, $parameters);
- }
-
- //For as long as the socket is open, read lines and pass them to the callback
+
$c = clone $this;
+
while ($this->socket && !feof($this->socket)) {
$e = NULL;
$e2 = NULL;

2 comments on commit 49d0bec

@MrTrick
Collaborator

Oops, this was not meant to revert at the server. (Still getting used to git)
Can this be fixed so the previous commit gets applied again?

@dready92
Owner

Hello,

read the doc on git-reset , I think it should be something like git reset --hard HEAD^

Mickael

Please sign in to comment.
Something went wrong with that request. Please try again.