Using UNIX sockets

66 views
Skip to first unread message

Nivertius

unread,
Jun 13, 2009, 10:17:12 AM6/13/09
to rtGui
Hello.

rtGui v0.2.7 can only connect to rTorrent trought RPC over HTTP. But
rTorrent can also create local UNIX socket to connect to. With PHPs
capability of opening these socket I wrote patch for rtGui to do so.
Basically, with it you can set 'scgi_local' in rtorrent config file,
set $rpc_connect='unix:///path/to/socket' and viola! rtgui without
configuring apache or lighttpd to mount RPC.
Patch for it is here: http://overlord.uaznia.net/misc/rtgui-0.2.7-unix-socket.diff

Thanks for doing this gui. :)

Sheldon Els

unread,
Jun 13, 2009, 10:39:37 AM6/13/09
to rt...@googlegroups.com
Wow dude, that is very nice. A bit more secure too :)

Sam Redfern

unread,
Jun 13, 2009, 1:51:32 PM6/13/09
to rt...@googlegroups.com
55 points for ultra cool!

- Sam Redfern

llamaX

unread,
Jun 13, 2009, 8:22:52 PM6/13/09
to rtGui
Very interesting. However, strlen seems silly when it's a fixed
length:

if(substr ($rpc_connect, 0, strlen('http://')) == 'http://') {

shezq23

unread,
Jul 9, 2009, 1:56:16 PM7/9/09
to rtGui
I would change

$result = fread($socket, 65536);

to

if (($result = stream_get_contents($socket)) == FALSE) { .. error
handler .. }

fread can only read so much into memory as defined in php.ini. I have
about 50-100 torrents in rtorrent and I would only get partial
responses from the response.
stream_get_contents reads everything in the socket buffer and does its
own memory management apparently.

And kudos to this patch, I tested it, it definitely works better than
with lighty.

Nivertius

unread,
Jul 26, 2009, 10:50:30 AM7/26/09
to rtGui
Oh my, thanks a lot for that, that's why my extremaly large SG-1
torrent didn't show up.
I don't know how rtGui handles errors, but fread has been replaced to
stream_get_contents in my patch [you just posted a patch to a
patch ;-)]
Thanks again.
Reply all
Reply to author
Forward
0 new messages