Jump to content

Errors in WebUI Protocol Implementation


rdnetto

Recommended Posts

Hi,

I've been writing a program designed to interface with uTorrent via its WebUI interface, and I have a found that several values returned by "?action=getsettings" do not have the correct type. webui.username, webui.password, webui.guest, & webui.cookie are all marked as type 0, which is supposed to mean integer, according to http://forum.utorrent.com/viewtopic.php?id=25661#p258859. However, these values are strings (corresponding typecode is 2). This problem occurs on uTorrent 1.7.7 build 8179.

Also, I have found that several settings which are marked as integers return an empty set of quotes ("") - does this imply a value of 0? (This includes all the fields which are supposed to return the build number).

I would appreciate it if the program (or the WebUI API Reference at the previous link) could be updated to reflect this.

Link to comment
Share on other sites

Frankly, the type/value elements of the array aren't really necessary. If a value is supposed to be an integer, µTorrent should actually be returning an actual integer, not a stringified integer. If it's supposed to be a boolean, just send a boolean. This is among the various suggestions that Directrix and I have made regarding µTorrent's JSON output, but it'll probably come another time.

Link to comment
Share on other sites

Sorry, it is fixed in the 1.8 RC. However, field reserved for the build number is still blank ({"" : "");

And Ultima, I believe that the type element is relevant if there is no reference for the settings. Also, if you use a strongly typed language to interface with uTorrent, you'll end up writing some sort of script to generate the type definition for settings, etc. which will rely on the type elements. Becase there are aprox 170 different settings, entering the types manually would be unreasonable - if you're going to remove the type element, make sure that you setup a reference for the settings somewhere.

EDIT:

The build field isn't blank in the RC - I guess I must have been using a different build or something.

Link to comment
Share on other sites

Well, a JSON parser should ideally take care of the types for you in a strongly-typed language (maybe with a wrapper/variant class of some sort). Figuring the type out would perhaps then be just a question of looking at some flag in the object. µTorrent already uses numbers and strings in its JSON output, so if your JSON parser doesn't already handle types, it'll have trouble elsewhere besides the settings array.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...