Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

409 Conflict #15

Open
brycied00d opened this issue Mar 31, 2012 · 3 comments
Open

409 Conflict #15

brycied00d opened this issue Mar 31, 2012 · 3 comments

Comments

@brycied00d
Copy link
Owner

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:

@ghost ghost assigned brycied00d Mar 31, 2012
@qriff
Copy link

qriff commented Oct 12, 2012

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]

@ruckfull
Copy link

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.

@Denoder
Copy link

Denoder commented May 2, 2017

so what is the fix for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants