simonbcn Posted September 3, 2010 Report Posted September 3, 2010 I've tried several actions and no work.I receive, in all of them, the next error:invalid requestFor example, I have tried, in Chromium 6, with the next URL:http://IPserver:9999/gui/?action=getversion
simonbcn Posted September 3, 2010 Author Report Posted September 3, 2010 Token authentication.Ok, sorry for this question but how can I obtain that token?I don't find this info in that url. I have seen the source of webUI html but I don't find this value.Regards.
DreadWingKnight Posted September 3, 2010 Report Posted September 3, 2010 Re-read the thread then. It covers that.
mipa Posted September 3, 2010 Report Posted September 3, 2010 it seems that there is an issue with action even with using the token..actions that fail- add-file- add-urland also&list=1they all return "invalid request"is there maybe a problem with the tokens?
DreadWingKnight Posted September 3, 2010 Report Posted September 3, 2010 Where are you putting the token?Give the full query string please.
mipa Posted September 3, 2010 Report Posted September 3, 2010 http://192.168.200.120:8080/gui/?token=TxyXnx2nX6U1QpcJafdceprTCo3j16ExlB703mIDpKX6N2soU2K1FjpvgUw=&list=1same request works with current windows uTorrent...it works for me if i set webui.token_auth=0, so the problem must be the token...
simonbcn Posted September 3, 2010 Author Report Posted September 3, 2010 http://192.168.200.120:8080/gui/?token=TxyXnx2nX6U1QpcJafdceprTCo3j16ExlB703mIDpKX6N2soU2K1FjpvgUw=&list=1To me "list=1" works.
mipa Posted September 3, 2010 Report Posted September 3, 2010 # curl -u admin:admin http://192.168.200.120:8080/gui/token.html<html><div id='token' style='display:none;'>2x2Dra2xSQ4bfNvJZUQrlZicoCFxQF9hBPfNhLBU0QuIrhrIb75sZ7yJgUw=</div></html># curl -u admin:admin "http://192.168.200.120:8080/gui/?list=1&token=2x2Dra2xSQ4bfNvJZUQrlZicoCFxQF9hBPfNhLBU0QuIrhrIb75sZ7yJgUw="invalid request
mcdonald Posted September 4, 2010 Report Posted September 4, 2010 # curl -u admin:admin "http://192.168.200.120:8080/gui/?list=1&token=2x2Dr..."invalid requestTry putting the token parameter first in the parameter list.
mipa Posted September 4, 2010 Report Posted September 4, 2010 same result.maybe there should be included some debuglogging in the server to debug such a case.any more ideas?
Ultima Posted September 4, 2010 Report Posted September 4, 2010 But the WebUI that comes with µTorrent Linux works, and can list the torrents? If so, that doesn't really make much sense...
mipa Posted September 4, 2010 Report Posted September 4, 2010 yes, the gui in webbrwoser works fine. does the webui use tokens?everything works fine for my scripts, if i disable token auth.
Ultima Posted September 4, 2010 Report Posted September 4, 2010 Can you check Firebug (if you're using Firefox) or Chromium's Developer Tools (if you're using Chromium) to see what requests WebUI is making, and how it differs from your own requests (other than token value)? If nothing, then I'm not really sure what to say... perhaps a session cookie issue of some sort?
funicorn Posted November 3, 2010 Report Posted November 3, 2010 same problem here, ubuntu 10.10. It's a pity to lose action feature, or else one can make a script to handle torrent files and url's more easily.
lithopsian Posted November 3, 2010 Report Posted November 3, 2010 Actions do work through the web API, and you can use them with token auth. Here is an example script implementing the ?list=1 command:#!/bin/bash# Get tokenexport token=$(curl -G -s -c ~/.utorrent/ucookie.txt -n http://192.168.0.4:8080/gui/token.html|sed 's/<[^<>]*>//g')# echo $token# curl -G -s -n -b ~/.utorrent/ucookie.txt -d token=$token -d list=1 http://192.168.0.4:8080/gui/I also have scripts for ?command, ?add-url, and a couple more.
Romanmir Posted May 10, 2011 Report Posted May 10, 2011 Been fighting this as well for about the last three-ish days.Keep getting "invalid login" as well.Yes, I've been using the correct IP:Port/gui/?list=1No, I have no interest in using the Auth_tokens at this time as I'd like to get this working before implementing auth_token.ubuntu 10.04.2WebUI 0.381utorrent 3.0-25053Relevant part of the config file:ut_webui_port: 8081webui_dir_files: webui.ziptoken_auth_enable: 0This is the program that I've been trying to set up:#!/usr/bin/perl -wuse strict;use Net::uTorrent;my $utorrent = Net::uTorrent->new ( hostname => '192.168.1.50', port => '8081', user => 'admin', pass => 'is correct',);die unless $utorrent->login_success;my $token = $utorrent->token();my $torrent_list = $utorrent->torrents();print $token;print $torrent_list;#print "\nSuccess!!\n";Below is what I get when I run the above program against my installation of utorrent.romanmir perl $ ./utorrent.plmalformed JSON string, neither array, object, number, string or atom, at character offset 2 (before "invalid request") at /usr/local/share/perl/5.10.1/Net/uTorrent.pm line 82.
lithopsian Posted May 11, 2011 Report Posted May 11, 2011 Confirm login details using webui. The config file is not necessarily what you are using. You can change the login details using webui Tools button, and also check token_auth in the advanced section.I also see several problems in your code. Why are you trying to parse out a token when token_auth is (supposed to ) be switched off? The correct URL for getting a token would be http://192.168.1.50:8081/gui/token.html. The token will not be returned in a JSON string, but in an HTML string, which can also be parsed as XML.The correct URL for other actions (not getting a token) is http://192.168.1.50:8081/gui/? followed by the relevant action string. I don't see this URL being formed in your code.
Romanmir Posted May 11, 2011 Report Posted May 11, 2011 Yeah, the code that I have there isn't intended to do anything but test a few things. Once I get any sort of result other than "invalid request" I'm gonna be doing other things with this.I'm looking in the "Advanced" section of the settings webui settings and I'm not seeing anything about use token_auth. Now in the previous webui version I did see that under advanced. Unless I'm missing something.It's entirely possible I was looking at this from the wrong perspective. i was thinking that the .conf file controls the behavior of the application. But are you are saying it's the other way around?As far as where the actual get request comes from, I believe it comes from the Net::uTorrent module being use in this script.Thanks for your response.
Romanmir Posted May 12, 2011 Report Posted May 12, 2011 @lithopsianIt was as you said. It turns out that the conf file that gets created has no bearing on the actual settings. Seems pretty unintuitive on a linux machine. But, whatever. Perhaps that could be added to the docs in the future?In any case, thank you for pointing me in the right direction.Rom
lithopsian Posted May 13, 2011 Report Posted May 13, 2011 The .conf file does have an effect but only the first time utserver is executed, which means that there is no other configuration for it to act on. The first time it runs it will create its own configuration then it will always ignore the .conf file. It is something of a bootstrap for the program that has no user interface.It would be nice if it would always read the .conf file so you could easily set things like the port without having to get the webui connected, but having configuration data in two places could also be confusing.I see the Net:uTorrent module must have a lot of logic I don't see. Glad it works now.
mcdonald Posted May 13, 2011 Report Posted May 13, 2011 The .conf file does have an effect but only the first time utserver is executed, which means that there is no other configuration for it to act on. The first time it runs it will create its own configuration then it will always ignore the .conf file.It would be nice if it would always read the .conf file so you could easily set things like the port without having to get the webui connected, but having configuration data in two places could also be confusing.uTorrent Server reads the configuration file every time it starts, when it receives a hangup signal, or when it detects a file-based maintenance request to do so. Some settings are as you say, defaults that apply only when settings.dat does not exist. Other settings are read and applied every time. See the documentation for information on which settings are applied when.
lithopsian Posted May 14, 2011 Report Posted May 14, 2011 uTorrent Server reads the configuration file every time it starts, when it receives a hangup signal, or when it detects a file-based maintenance request to do so. Some settings are as you say, defaults that apply only when settings.dat does not exist. Other settings are read and applied every time. See the documentation for information on which settings are applied when.My documentation says:The settings for which the values are always applied from the configurationfile when the file is read by the server include: • dir_request • finish_cmd • logmask • preferred_interface • state_cmd • ut_webui_dirThe implication is that this is not a complete list. Whether it is or not, the values that I would find most useful to be able to change in the .conf file, such as the port, address, and login settings, do not seem to be read every time.
skyy99 Posted November 2, 2011 Report Posted November 2, 2011 # curl -u admin:admin http://192.168.200.120:8080/gui/token.html<html><div id='token' style='display:none;'>2x2Dra2xSQ4bfNvJZUQrlZicoCFxQF9hBPfNhLBU0QuIrhrIb75sZ7yJgUw=</div></html># curl -u admin:admin "http://192.168.200.120:8080/gui/?list=1&token=2x2Dra2xSQ4bfNvJZUQrlZicoCFxQF9hBPfNhLBU0QuIrhrIb75sZ7yJgUw="invalid requestNot quite. But since nobody answered this, I suppose I will:#!/bin/bash# Get tokenexport token=$(curl -G -s -u user:pass -c ~/.utorrent/ucookie.txt http://192.168.0.4:8080/gui/token.html | sed 's/<[^<>]*>//g')curl -G -s -u user:pass -b ~/.utorrent/ucookie.txt -d token=$token -d list=1 http://192.168.0.4:8080/gui/What's important here is that the cookie is sent along with all subsequent requests (I don't know when this changed, but it needs to be sent along now). Also, the username/password needs to accompany all subsequent requests as well. Frankly I don't see much adoption of the auth system when it is not documented well enough for people to use. Shame on the devs for not making this more usable.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.