Quantcast

HTTPSocket POST file upload problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

HTTPSocket POST file upload problem

Stuart Bridger
I am having problems uploading files from a remote server. Some of the files download fine but others are incomplete. Strangely, the incomplete files are always exactly the same length but I get unexpected end of file when uncompressing them using gzip.

$httpSocket = new HttpSocket();
$zipFile = fopen(TMP . 'tmp_file.gz', 'w');

$httpSocket->setContentResource($zipFile);
$fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' => true));

fclose($zipFile);

The URL redirects to an Amazon S3 bucket.

Is there any way of checking if this is a problem at my end? Looked in Apache and PHP error logs but can see nothing relevant.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: HTTPSocket POST file upload problem

Stuart Bridger
I have tried using Wireshark to figure out the problem and it appears that the communication is fine for a while and then my server sends an SSL alert 21 which means that a packet could not be decrypted. After this my server starts sending reset requests which are ignored by the remote server.

On Saturday, 18 August 2012 08:39:24 UTC+1, Stuart Bridger wrote:
I am having problems uploading files from a remote server. Some of the files download fine but others are incomplete. Strangely, the incomplete files are always exactly the same length but I get unexpected end of file when uncompressing them using gzip.

$httpSocket = new HttpSocket();
$zipFile = fopen(TMP . 'tmp_file.gz', 'w');

$httpSocket->setContentResource($zipFile);
$fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' => true));

fclose($zipFile);

The URL redirects to an Amazon S3 bucket.

Is there any way of checking if this is a problem at my end? Looked in Apache and PHP error logs but can see nothing relevant.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: HTTPSocket POST file upload problem

Stuart Bridger
In reply to this post by Stuart Bridger
Okay, I have just successfully transferred the file from the remote server to my server using cURL by first authenticating, saving a cookie and then sending another request for the file. I'll proceed with my project using this method unless I get any feedback relating to my issue with HTTPSocket.

On Saturday, 18 August 2012 08:39:24 UTC+1, Stuart Bridger wrote:
I am having problems uploading files from a remote server. Some of the files download fine but others are incomplete. Strangely, the incomplete files are always exactly the same length but I get unexpected end of file when uncompressing them using gzip.

$httpSocket = new HttpSocket();
$zipFile = fopen(TMP . 'tmp_file.gz', 'w');

$httpSocket->setContentResource($zipFile);
$fileResponse = $httpSocket->get('URL_to_file', array(), array('redirect' => true));

fclose($zipFile);

The URL redirects to an Amazon S3 bucket.

Is there any way of checking if this is a problem at my end? Looked in Apache and PHP error logs but can see nothing relevant.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Loading...