Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error when uploading via Zend_Gdata behind proxy #36

Closed
zfbot opened this Issue · 2 comments

2 participants

@zfbot
Owner

Jira Information

Original Issue: ZF-12475
Issue Type: Bug
Reporter: Chris Grice
Created: 11/27/12
Assignee: Trevor Johns
Components: Zend_Gdata

Description

When using Zend_Gdata to upload to youtube while behind a proxy, Zend_Gdata_HttpAdapterStreamingProxy throws a fatal error:

Fatal error: Call to undefined method Zend_Gdata_MediaMimeStream::hasData() in Zend/Gdata/HttpAdapterStreamingProxy.php on line 118

Using the implementation of the same functionality in Zend_Gdata_HttpAdapterStreamingSocket the upload completes successfully.

I.e replacing the lines from 118 to 124:

     while ($body->hasData()) {
        if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) {
            require_once 'Zend/Http/Client/Adapter/Exception.php';
            throw new Zend_Http_Client_Adapter_Exception(
                'Error writing request to server');
        }
    }

with the following:

    $chunk = $body->read(self::CHUNK_SIZE);
    while ($chunk !== FALSE) {
        if (! @fwrite($this->socket, $chunk)) {
            require_once 'Zend/Http/Client/Adapter/Exception.php';
            throw new Zend_Http_Client_Adapter_Exception(
                'Error writing request to server');
        }
        $chunk = $body->read(self::CHUNK_SIZE);
    }
    $body->closeFileHandle();

fixes the issue.

@zfbot
Owner

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF-12475

Known GitHub users mentioned in the original message or comment:

@froschdesign
Collaborator

Ugly coding style in the Zend_Gdata classes, but I can confirm the problem.

@froschdesign froschdesign self-assigned this
@froschdesign froschdesign added this to the 1.12.10 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.