mimtek / rutorrent

Automatically exported from code.google.com/p/rutorrent
0 stars 0 forks source link

Can't use the RPC plugin with scgi_local #160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I setup rtorrent.rc with scgi_local:

$ grep scgi /etc/rtorrent.rc 
scgi_local = /tmp/rpc.socket

I use the RPC plugin, and configured rutorrent to use the RPC socket:

$ grep 
scgi /var/www/rtorrent/config.php                                          

$scgi_port = 0;
$scgi_host = "unix:///tmp/rpc.socket";

When I load the rutorrent webpage, I get the following error:
-------------------------
[07.11.2009 19:44:30] WebUI started.
[07.11.2009 19:44:31] Bad link to rTorrent. Check if it is really running. 
Check $scgi_port and $scgi_host settings in config.php and scgi_port in 
rTorrent configuration file.
[07.11.2009 19:44:31] Bad response: (404) <?xml version="1.0" 
encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" 
xml:lang="en" lang="en"> <head> <title>404 - Not Found</title> </head> 
<body> <h1>404 - Not Found</h1> </body></html>
-------------------------

From the logs of the web server, it appears that rutorrent is trying to 
access /RPC2:
-------------------------
xxx.xxx.xxx.xxx hostname username [07/Nov/2009:19:44:32 
+0100]  "POST /RPC2 HTTP/1.1" 404 
345 "http://hostname/rtorrent/" "Mozilla/4.0"
-------------------------

Is this a bug or a configuration problem?
Thanks.

Original issue reported on code.google.com by jdck...@gmail.com on 7 Nov 2009 at 7:00

GoogleCodeExporter commented 9 years ago
1) Is file /tmp/rpc.socket really exists?
2) What about it access rights?
2) What about your OS?

Original comment by novik65 on 8 Nov 2009 at 7:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi.

1. yes, it's indeed a socket:
$ file /tmp/rpc.socket
/tmp/rpc.socket: socket

2. World-readable:
$ ls -al /tmp/rpc.socket
srwxr-xr-x 1 rtorrent nogroup 0 2009-11-08 09:32 /tmp/rpc.socket

3. uname -a
Linux hostname 2.6.31-1-amd64 #1 SMP Sat Oct 24 17:50:31 UTC 2009 x86_64 
GNU/Linux

rtorrent-2.7, 
rpc plugin svn rev. 11

Thanks,

Original comment by jdck...@gmail.com on 8 Nov 2009 at 8:35

GoogleCodeExporter commented 9 years ago
try putting something like this in rtorrent.rc
schedule = chmod,0,0,"execute=chmod,777,/tmp/rpc.socket"

Original comment by Wonslung@gmail.com on 8 Nov 2009 at 6:30

GoogleCodeExporter commented 9 years ago
>World-readable:

Web-server user must has the read/write access to this socket. See comment 4 
above.

Original comment by novik65 on 9 Nov 2009 at 8:22

GoogleCodeExporter commented 9 years ago
I tried with:

$ ls -al /tmp/rpc.socket
srwxrwxrwx 1 rtorrent nogroup 0 2009-11-10 19:49 /tmp/rpc.socket

and still got the same 404 error.

Any other idea?

Original comment by jdck...@gmail.com on 10 Nov 2009 at 6:54

GoogleCodeExporter commented 9 years ago
which webserver? you have the socket set correctly in all locations?

Original comment by Wonslung@gmail.com on 11 Nov 2009 at 3:14

GoogleCodeExporter commented 9 years ago
>I use the RPC plugin, and configured rutorrent to use the RPC socket:

1) If you see in web-server log lines "POST /RPC2 HTTP/1.1" => RPC plugin is not
installed.
2) If you see in WebUI log lines "Bad link to rTorrent. Check if it is really 
running. 
Check $scgi_port and $scgi_host settings in config.php and scgi_port in 
rTorrent configuration file." => php can't connect to $scgi_host:$scgi_port.

Check configuration. Doesn't post here incorrect data, please.

Original comment by novik65 on 11 Nov 2009 at 8:32

GoogleCodeExporter commented 9 years ago
> which webserver? you have the socket set correctly in all locations?
lighttpd. Yes.

> 1) If you see in web-server log lines "POST /RPC2 HTTP/1.1" => RPC plugin is 
not
installed.
I do see POST /RPC2 in the web server log, AND the RPC plugin is installed. At 
least, 
I have a rpc/ directory under plugins/ which contains the RPC plugin files :
$ ls /var/www/rtorrent/plugins/rpc  
init.js rpc.php
Is there anything else required to enable the RPC plugin?

Original comment by jdck...@gmail.com on 12 Nov 2009 at 6:54

GoogleCodeExporter commented 9 years ago
do you have the port set in .rtorrent.rc 

scgi_port = 127.0.0.1:5000

Original comment by Wonslung@gmail.com on 12 Nov 2009 at 7:03

GoogleCodeExporter commented 9 years ago
>Is there anything else required to enable the RPC plugin?

Web-server user must has read\execute access to directory rpc and read access 
to it
contents. If plugin is installed correctly, you will see in web-server access 
log
lines like "POST /rtorrent/plugins/rpc/rpc.php HTTP/1.1" instead "POST /RPC2 
HTTP/1.1". 

Original comment by novik65 on 13 Nov 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Wait, it doesn't make any sense: I don't have anything related to SCGI nor RPC 
in my
webserver configuration, and the rpc plugin works when I have
scgi_port=localhost:5000 in rtorrent.rc. But as soon as I try to use
scgi_local=/tmp/rpc.socket (and updating config.php accordingly), it doesn't 
work
anymore. 

Would it be possible to have simple instructions on how to use the RPC plugin 
with a
local socket?

To summarize :

1. my rtorrent.rc file contains:
    scgi_local = /tmp/rpc.socket
(no scgi_port)

2. permissions on the socket are enough for every user to read and write to it:
    # ls -al /tmp/rpc.socket
    srwxr-xr-x 1 rtorrent nogroup 0 2009-11-22 11:16 /tmp/rpc.socket

3. my lighttpd.conf does not contain anything related to SCGI nor RPC 

4. the rpc plugin is here and readable by the webserver user:
    # ls -al /var/www/rtorrent/plugins/rpc/
    total 20
    drwxr-xr-x  3 www-data www-data 4096 2009-11-21 21:59 .
    drwxr-xr-x 24 www-data www-data 4096 2009-09-30 12:23 ..
    -rw-r--r--  1 www-data www-data   55 2009-11-07 19:47 init.js
    -rw-r--r--  1 www-data www-data  627 2009-11-10 19:51 rpc.php

5. ruTorrent's config.php contains:
    $scgi_port = 0;
    $scgi_host = "unix:///var/lib/rtorrent/rpc.socket";

When I load the ruTorrent web interface, I get the following error in the 
browser:

[22.11.2009 11:24:54] Bad link to rTorrent. Check if it is really running. Check
$scgi_port and $scgi_host settings in config.php and scgi_port in rTorrent
configuration file.
[22.11.2009 11:24:55] Bad response: (404) <?xml version="1.0"
encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>404 
-
Not Found</title> </head> <body> <h1>404 - Not Found</h1> </body> </html>

And the webserver (lighttpd) log file contains :

::ffff:xxx.xxx.xxx.xxx host.tld - [22/Nov/2009:11:24:58 +0100] "POST /RPC2 
HTTP/1.1"
404 345 "https://host.tld/rtorrent/" "-"

So it seems to me that the RPC plugin does not understand it needs to connect 
to the
/tmp/rpc.socket socket, and that it still tries to connect through the network
socket. Everything works fine if I just change back 
    scgi_local = /tmp/rpc.socket
to 
    scgi_port = localhost:5000  
in rtorrent.rc, and 
    $scgi_port = 0;
    $scgi_host = "unix:///var/lib/rtorrent/rpc.socket";
to
    $scgi_port = 5000;
    $scgi_host = "127.0.0.1";
in config.php

Thanks for any insight.
Cheers,

Original comment by jdck...@gmail.com on 22 Nov 2009 at 10:34

GoogleCodeExporter commented 9 years ago
>2. permissions on the socket are enough for every user to read and write to it:
># ls -al /tmp/rpc.socket
>srwxr-xr-x 1 rtorrent nogroup 0 2009-11-22 11:16 /tmp/rpc.socket

Don't understand. You really thinking - "srwxr-xr-x" is mean "every user to 
read and
write"?

>1. my rtorrent.rc file contains: scgi_local = /tmp/rpc.socket
>5. ruTorrent's config.php contains: $scgi_host = 
"unix:///var/lib/rtorrent/rpc.socket";

For wich reason rtorrent.rc and config.php contains *different* path to rpc 
socket?

Original comment by novik65 on 23 Nov 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Nevermind, I screwed it up. My configuration was not coherent... My bad.
The RPC plugin seems to be working with a local scgi socket, now.

Thanks a lot for your time.

Original comment by jdck...@gmail.com on 23 Nov 2009 at 6:31

GoogleCodeExporter commented 9 years ago
What was wrong? I'm trying to set this up myself. Was it this?

 2. permissions on the socket are enough for every user to read and write to it:
    # ls -al /tmp/rpc.socket
    srwxr-xr-x 1 rtorrent nogroup 0 2009-11-22 11:16 /tmp/rpc.socket

Original comment by lucasreddinger on 14 Jul 2012 at 11:31

GoogleCodeExporter commented 9 years ago
This place is not a forum. Use forum for your questions.

Original comment by novik65 on 14 Jul 2012 at 11:39