Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

409 Conflict #15

Open
GoogleCodeExporter opened this issue Mar 25, 2015 · 1 comment
Open

409 Conflict #15

GoogleCodeExporter opened this issue Mar 25, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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.

Original issue reported on code.google.com by mathewpa...@gmail.com on 13 Feb 2012 at 7:51

@GoogleCodeExporter
Copy link
Author

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 )
      {
...

Original comment by farvo...@gmail.com on 13 Aug 2013 at 4:51

  • Added labels: ****
  • Removed labels: ****

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

No branches or pull requests

1 participant