PHP-Transmission-Class icon indicating copy to clipboard operation
PHP-Transmission-Class copied to clipboard

409 Conflict

Open brycied00d opened this issue 12 years ago • 3 comments

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.

Google Code Info: Issue #: 15 Author: [email protected] Created On: 2012-02-13T07:51:40.000Z Closed On:

brycied00d avatar Mar 31 '12 21:03 brycied00d

This is because of having cURL as your PHP HTTP Wrapper which doesn't return headers before read once with fread(), thanks to http://stackoverflow.com/questions/6688039/wrapper-data-is-empty , or something in the general direction. At least it returns them on our fread() fixed version.

There is also some obvious additional tweaking needed since the $stream_meta['wrapper_data'][0] structure have changed to $stream_meta['wrapper_data']['headers'][0] .

Hopefully this fix message reaches someone who find the time to provide a patch with wrapper type detection ( found in $stream_meta['wrapper_type'] ), etc.

TRANSMISSIONRPC_DEBUG:: request( method=torrent-get, ...):: Stream meta info:
Array
(
    [wrapper_data] => Array
        (
            [headers] => Array
                (
                    [0] => HTTP/1.1 200 OK
                    [1] => Server: Transmission
                    [2] => Content-Type: application/json; charset=UTF-8
                    [3] => Date: Fri, 12 Oct 2012 08:07:58 GMT
                    [4] => Content-Length: 542
                )

            [readbuf] => Resource id #16
        )

    [wrapper_type] => cURL
    [stream_type] => cURL
    [mode] => r
    [unread_bytes] => 0
    [seekable] =>
    [uri] => http://localhost:9091/transmission/rpc
    [timed_out] =>
    [blocked] => 1
    [eof] => 1
)
[/code]

qriff avatar Oct 12 '12 08:10 qriff

thanks very much !!

ruckfull

From: qriff Date: 2012-10-12 16:13 To: brycied00d/PHP-Transmission-Class Subject: Re: [PHP-Transmission-Class] 409 Conflict (#15) This is because of having cURL as your PHP HTTP Wrapper which doesn't return headers before read once with fread(), thanks to http://stackoverflow.com/questions/6688039/wrapper-data-is-empty , or something in the general direction. At least it returns them on our fread() fixed version. There is also some obvious additional tweaking needed since the $stream_meta['wrapper_data'][0] structure have changed to $stream_meta['wrapper_data']['headers'][0] . Hopefully this fix message reaches someone who find the time to provide a patch with wrapper type detection ( found in $stream_meta['wrapper_type'] ), etc. TRANSMISSIONRPC_DEBUG:: request( method=torrent-get, ...):: Stream meta info: Array ( [wrapper_data] => Array ( [headers] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: Transmission [2] => Content-Type: application/json; charset=UTF-8 [3] => Date: Fri, 12 Oct 2012 08:07:58 GMT [4] => Content-Length: 542 )

        [readbuf] => Resource id #16
    )

[wrapper_type] => cURL
[stream_type] => cURL
[mode] => r
[unread_bytes] => 0
[seekable] =>
[uri] => http://localhost:9091/transmission/rpc
[timed_out] =>
[blocked] => 1
[eof] => 1

) [/code]

— Reply to this email directly or view it on GitHub.

ruckfull avatar Oct 12 '12 08:10 ruckfull

so what is the fix for this?

Denoder avatar May 02 '17 19:05 Denoder