Issue 15 in php-transmission-class: 409 Conflict

5 views
Skip to first unread message

php-transmi...@googlecode.com

unread,
Feb 13, 2012, 2:52:15 AM2/13/12
to php-transmi...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 15 by mathewpa...@gmail.com: 409 Conflict
http://code.google.com/p/php-transmission-class/issues/detail?id=15

When the library tries to get the session id. On line 422:

if ( ! $fp = fopen( $this->url, 'r', false, $context ) ) // Open a
filepointer to the data, and use fgets to get the result

The problem is that when it fopens the server returns the 409 conflict
message with the session ID but no file handle is returned to $fp because
it was an error.

I found a similar issue tagged as Issue #6. But that one says we need PHP
5.2.6 minimum. I am running on PHP 5.5.3.

Please see the output of php -v:

PHP 5.3.3-7+squeeze6 with Suhosin-Patch (cli) (built: Jan 31 2012 19:30:53)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

I have commented the same on Issue #6. If you wish to handle it in the old
Issue, please delete this one.

php-transmi...@googlecode.com

unread,
Aug 13, 2013, 12:51:28 PM8/13/13
to php-transmi...@googlegroups.com

Comment #1 on issue 15 by farvo...@gmail.com: 409 Conflict
http://code.google.com/p/php-transmission-class/issues/detail?id=15

I resolved this problem as follows:
...
// Check the response (headers etc)
$stream_meta = stream_get_meta_data( $fp );

if( isset( $stream_meta['wrapper_data']['headers'] )) $stream_headers =
$stream_meta['wrapper_data']['headers'];
else $stream_headers = $stream_meta['wrapper_data'];

fclose( $fp );
if( $this->debug ) echo "TRANSMISSIONRPC_DEBUG:: GetSessionID()::
Stream meta info: ".
PHP_EOL . print_r( $stream_meta, true );
if( $stream_meta['timed_out'] )
throw new TransmissionRPCException( "Timed out connecting to
{$this->url}", TransmissionRPCException::E_CONNECTION );
if( substr( $stream_headers[0], 9, 3 ) == "401" )
throw new TransmissionRPCException( "Invalid username/password.",
TransmissionRPCException::E_AUTHENTICATION );
elseif( substr( $stream_headers[0], 9, 3 ) == "409" ) // This is what
we're hoping to find
{
// Loop through the returned headers and extract the
X-Transmission-Session-Id
foreach( $stream_headers as $header )
{
...

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages