Skip to content
4 changes: 3 additions & 1 deletion src/Api/TaskQueue/PushQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function addTasks($tasks) {
'All values in $tasks must be instances of PushTask. ' .
'Actual type: ' . gettype($task));
}
$names[] = $task->getName();
array_push($names, $task->getName());
$add = $req->addAddRequest();
$add->setQueueName($this->name);
$add->setTaskName($task->getName());
Expand All @@ -170,6 +170,8 @@ public function addTasks($tasks) {
$header_pb = $add->addHeader();
$header_pb->setKey(trim($pair[0]));
$header_pb->setValue(trim($pair[1]));
echo "<br>ZACH KEY&VALUE: " . trim($pair[0]) . " " . trim($pair[1]);

}
// TODO: Replace getQueryData() with getBody() and simplify the following
// block.
Expand Down
13 changes: 8 additions & 5 deletions src/Api/TaskQueue/PushTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ final class PushTask {
'header' => '',
];

private $url;
public $url;

private $query_data;
public $query_data;

private $options;
public $options;

private $headers = [];
public $headers = [];

/**
* Construct a PushTask.
Expand Down Expand Up @@ -177,7 +177,7 @@ public function __construct($url_path, $query_data = [], $options = []) {
if (in_array($this->options['method'], ['GET', 'HEAD', 'DELETE'])) {
$this->url = $url_path . '?' . http_build_query($query_data);
} else { // PUT or POST
$this->headers[] = 'content-type: application/x-www-form-urlencoded';
array_push($this->headers,'content-type: application/x-www-form-urlencoded');
}
}
if (strlen($this->url) > self::MAX_URL_LENGTH) {
Expand All @@ -195,6 +195,7 @@ public function __construct($url_path, $query_data = [], $options = []) {

$has_content_type = !empty($this->headers);
$header_array = explode("\r\n", $header);

foreach ($header_array as $h) {
$h = trim($h);
if (empty($h)) {
Expand All @@ -210,6 +211,8 @@ public function __construct($url_path, $query_data = [], $options = []) {
throw new \InvalidArgumentException('Content-type header may not ' .
'be specified as it is set by the task.');
}
echo "<br>Headerss: " . $h . "<br>";
// array_push($this->headers, $h);
$this->headers[] = $h;
}
}
Expand Down
31 changes: 16 additions & 15 deletions src/Api/TaskQueue/taskqueue_service_pb.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function setUserEmail($idx, $val) {
return $this;
}
public function addUserEmail($val) {
$this->user_email[] = $val;
array_push($this->user_email, $val);
return $this;
}
public function clearUserEmail() {
Expand All @@ -389,7 +389,7 @@ public function setWriterEmail($idx, $val) {
return $this;
}
public function addWriterEmail($val) {
$this->writer_email[] = $val;
array_push($this->writer_email, $val);
return $this;
}
public function clearWriterEmail() {
Expand Down Expand Up @@ -895,6 +895,7 @@ public function shortDebugString($prefix = "") {
namespace google\appengine {
class TaskQueueAddRequest extends \google\net\ProtocolMessage {
private $header = array();

public function getQueueName() {
if (!isset($this->queue_name)) {
return '';
Expand Down Expand Up @@ -1009,7 +1010,7 @@ public function getHeader($idx) {
}
public function addHeader() {
$val = new \google\appengine\TaskQueueAddRequest\Header();
$this->header[] = $val;
array_push($this->header, $val);
return $val;
}
public function clearHeader() {
Expand Down Expand Up @@ -1757,7 +1758,7 @@ public function getAddRequest($idx) {
}
public function addAddRequest() {
$val = new \google\appengine\TaskQueueAddRequest();
$this->add_request[] = $val;
array_push($this->add_request, $val);
return $val;
}
public function clearAddRequest() {
Expand Down Expand Up @@ -1974,7 +1975,7 @@ public function getTaskResult($idx) {
}
public function addTaskResult() {
$val = new \google\appengine\TaskQueueBulkAddResponse\TaskResult();
$this->taskresult[] = $val;
array_push($this->taskresult, $val);
return $val;
}
public function clearTaskResult() {
Expand Down Expand Up @@ -2078,7 +2079,7 @@ public function setTaskName($idx, $val) {
return $this;
}
public function addTaskName($val) {
$this->task_name[] = $val;
array_push($this->task_name, $val);
return $this;
}
public function clearTaskName() {
Expand Down Expand Up @@ -2225,7 +2226,7 @@ public function setResult($idx, $val) {
return $this;
}
public function addResult($val) {
$this->result[] = $val;
array_push($this->result, $val);
return $this;
}
public function clearResult() {
Expand Down Expand Up @@ -2715,7 +2716,7 @@ public function getHeaderOverride($idx) {
}
public function addHeaderOverride() {
$val = new \google\appengine\TaskQueueHttpHeader();
$this->header_override[] = $val;
array_push($this->header_override, $val);
return $val;
}
public function clearHeaderOverride() {
Expand Down Expand Up @@ -3330,7 +3331,7 @@ public function getHeaderOverride($idx) {
}
public function addHeaderOverride() {
$val = new \google\appengine\TaskQueueHttpHeader();
$this->header_override[] = $val;
array_push($this->header_override, $val);
return $val;
}
public function clearHeaderOverride() {
Expand Down Expand Up @@ -3666,7 +3667,7 @@ public function getQueue($idx) {
}
public function addQueue() {
$val = new \google\appengine\TaskQueueFetchQueuesResponse\Queue();
$this->queue[] = $val;
array_push($this->queue, $val);
return $val;
}
public function clearQueue() {
Expand Down Expand Up @@ -3770,7 +3771,7 @@ public function setQueueName($idx, $val) {
return $this;
}
public function addQueueName($val) {
$this->queue_name[] = $val;
array_push($this->queue_name, $val);
return $this;
}
public function clearQueueName() {
Expand Down Expand Up @@ -4323,7 +4324,7 @@ public function getQueueStats($idx) {
}
public function addQueueStats() {
$val = new \google\appengine\TaskQueueFetchQueueStatsResponse\QueueStats();
$this->queuestats[] = $val;
array_push($this->queuestats, $val);
return $val;
}
public function clearQueueStats() {
Expand Down Expand Up @@ -5895,7 +5896,7 @@ public function getHeader($idx) {
}
public function addHeader() {
$val = new \google\appengine\TaskQueueQueryTasksResponse\Task\Header();
$this->header[] = $val;
array_push($this->header, $val);
return $val;
}
public function clearHeader() {
Expand Down Expand Up @@ -6556,7 +6557,7 @@ public function getTask($idx) {
}
public function addTask() {
$val = new \google\appengine\TaskQueueQueryTasksResponse\Task();
$this->task[] = $val;
array_push($this->task, $val);
return $val;
}
public function clearTask() {
Expand Down Expand Up @@ -7564,7 +7565,7 @@ public function getTask($idx) {
}
public function addTask() {
$val = new \google\appengine\TaskQueueQueryAndOwnTasksResponse\Task();
$this->task[] = $val;
array_push($this->task, $val);
return $val;
}
public function clearTask() {
Expand Down
4 changes: 2 additions & 2 deletions src/Api/UrlFetch/UrlFetchStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ public function stream_open(string $url, string $mode, int $optionsStream, &$ope
$this->urlFetchResponse = $resp;
$this->stream = new CachingStream(Stream::factory($resp->getContent()));
$this->responseHeaders = $this->buildHeaderArray($resp->getStatuscode(), $resp->getHeaderList());
} catch (Exception $e) {
throw new Exception(sprintf("Caught UrlFetch Exception: %s", $e->getMessage()));
} catch (ApplicationError $e) {
throw new Exception(sprintf("Caught UrlFetch Exception: %s", $e->getApplicationError()));
}

if ($resp->getStatuscode() >= 400) {
Expand Down