bulljit / Transmission-Add-Torrent-Bookmarkelet

Bookmarklet to add torrents to Transmission WebUI from Iphone
32 stars 6 forks source link

Full URL of Torrent not being sent on some websites #8

Closed saltedlolly closed 13 years ago

saltedlolly commented 13 years ago

I have noticed an issue on some websites where only the nested part without the website domain of the URL are being sent which causes an error. An example:

http://www.torrentsite.com/Video/Unsorted/ubuntu.html

Fetchtorrent URL is:

http://mydyndns.url:9091/transmission/web/fetchtorrent.html?torrentlink=/Video/Unsorted/ubuntu.torrent

Care to take a look?

bulljit commented 13 years ago

Yup, I came across this while updating the code for private torrents. I already fixed it in that version...

I can add the patch to the older (non-cookie) version later today if you want, or we can wait a few days for the cookie-string rpc patch to be official in the Transmission.app

Check with the updated code i sent you, it should be working.

saltedlolly commented 13 years ago

It still seems to have a problem on some websites. The URL is getting scrambled.

bulljit commented 13 years ago

Can I get you to help me track down the bug?

Firstly lets get you the right tools:

Can you even download the link from your browser. I was getting a not found error when just trying to download it the conventional way w/o the bookmarklet. Perhaps I need to create an account at that site first... (if so, then it should be a simple fix).

saltedlolly commented 13 years ago

I installed all the tools, but I'm not really sure how to proceed with using them!

I have been doing my testing in Firefox for most of this. Easier than messing around with the mobile. Yes I also got a not found error. I didn't have an account on the site, myself.

How should I procedd?

bulljit commented 13 years ago

I'm guessing that it doesn't download b/c you need to be logged in, which will give us more cookie info. I'm not that enthusiastic about that site, since I just assume it's one of those fake ones, hoping that you click on their ADULT ads (you know you did!).

Probably best to proceed with only testing sites we actually use.

As for the firefox tools, it's to slowly build up your knowledge grasshopper. Most of our interaction on the internet is just a series of requests and responses between servers. The LiveHttpHeaders is an example to watch this in action. It will list your request, the remote servers response, and then any additional actions.

The key is to look at the GET/POST statements to see what is being sent and recieved.

Headers are just additional data being sent (i.e. cookies, session-id, etc). I fear that we will stubble upon a site that will check to make sure you actually requested a download from their own page. But if so, we will just add a "referrer" header to our requests.

Firebug is very similar, it has a console to view the transfer of info, but also other fun things. i.e. you can load a page, and then temporarily edit the CSS on Firebug to see how it looks and changes. So load up your webui, run fire bug, and click through the tabs, you will see all kinds of nifty stuff. Do the same with fetchtorrent.html and mess around with its CSS.

Play around, and you will catch on. It's more of me preparing you to help me in tracking down future bugs :)

bulljit commented 13 years ago

Have you checked on sites that have "relative" paths instead of "absolute paths"

relative : href = ./path/to/download absolute: href = www.example.com/path/to/download

I believed I fixed that with the new cookie-bookmarklet.

saltedlolly commented 13 years ago

The URLs on the problematic sites are fixed with the newer bookmarklet. I just tested it and it worked :)