Missing support for HTTP redirect (Error 301)

Bug #512958 reported by Brian D
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qBittorrent
Fix Released
Medium
Christophe Dumez

Bug Description

Initially, I installed qBitTorrent 1.2.1 on my Fedora Core 10 workstation, as that is the version that is in the Fedora 10 repositories. As I was reading up on the various functions/features, I became interested in the RSS feature. I set up ezRSS and it downloaded the last 30 or so items in the RSS feed. Reading through the version 2 documentation, I decided that I needed (okay, wanted!) the automatic download feature as well, so I upgraded to version 2.1.2 by downloading the source and configuring/compiling/installing.

When I started up 2.1.2, the ezRSS feed was still configured, but there were no longer any items in the list for that feed. Several attempts to refresh the list yielded nothing. I added a new RSS feed to the 2.1.2 installation, and it also stayed dormant with no items showing in the list. I have tried individually refreshing, as well as choosing the 'refresh all' option. On all occasions, the "refreshing" icon shows up next to the RSS feed for a while, then disappears, still with no items in the list. It appears that there is *some* communications going on with the RSS feeds, as the icon in bittorrent changes to the favicon sent with the feed after the first attempt to refresh.

I'm guessing that, maybe, something went amiss with the "conversion" on my system, as I updated the 1.2.1 installation from the Fedora repositories by installing the newly compiled 2.1.2 version over the top of the /usr/bin/qbittorrent executable. I see that some user directories and such have changed between versions, so maybe there's some issue with all of that. Perhaps you could tell me what I should expect to find, and where, in regards to configured RSS feeds -- where is the configuration supposed to be, what should be in it, and where are the RSS items from the feed stored once they've been retrieved from the RSS server?

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

I don't think this is a RSS configuration problem. It could be a proxy configuration problem though (check in program preferences).

If it is not a proxy problem then there has to be something else preventing the RSS feed download. Could you please compile qBittorrent with debug output? (simply change "DEBUG=1" in src/src.pro then recompile: ./configure && make clean && make)

The debug output may help understanding what happens.

It should not be a RSS parsing problem because I know that ezrss feed is valid.

Revision history for this message
Brian D (turbo) wrote :

I can try compiling with debug, sure.

I don't think there's an issue with a proxy setting, as I have set no proxies up. ...and, it'd be using the same proxy as the torrent search facility, yes? That feature works flawlessly.

(as an aside, sorry for how this comment appears on the ticket -- launchpad gives me a "add a comment" text box, but there is no way to submit the text I've added there!!)

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

Your comment appears fine on the ticket.

The downloads in the search engine are made using Python.
The RSS downloads are made Using Qt4/C++.

Could you try downloading a torrent using the "download from URL" feature and see if it work? This code uses C++/Qt4 too.

Revision history for this message
Brian D (turbo) wrote :

I understand.

I'm pretty sure I've used the "download from URL" option to add a torrent, as I have been grabbing the URLs from the EZTV IRC channel, in absence of the RSS feature working -- I can right-click/copy the url in the xchat window, then switch to qBitTorrent and choose "Download from URL" to add it to the mix... and that seems to be working just fine. I'm just not (at this point) sure whether I added those torrents when I was running 1.2.1 or after upgrading to 2.1.2. I will try it again in 2.1.2, this evening when I get home from work.

...as well as compiling with DEBUG=1 and snooping around the system for evidence of RSS traces. Can you tell me where the feed contents should be stored on the disk? are they usually found somewhere in the ~/.config/qbittorrent/ heirarchy, when all things are operating properly?

Revision history for this message
Brian D (turbo) wrote :

Okay, I've tried the "Download from URL" option in 2.1.2, and it works just fine.

I've set DEBUG=1 in src/src.pro and started the recompile. I will let you know when I've finished building/installing the debug build, and tried the RSS stuff again.

Revision history for this message
Brian D (turbo) wrote :

okay. I've compiled with DEBUG=1 set in src/src.pro, and installed it in /usr/bin, and fired the back up.

RSS feeds still acting the same way, even after deleting and re-entering them. No actual feed material shows after refresh.

I see no *obvious* debug output anywhere (console log, miscellaneous log files in the user directory, or in ~/.config/qBittorrent/ or in /tmp, or anywhere else, nothing new or informative displaying anywhere in the application, so please spoon-feed me what to do next.

Also, I'm still curious as to where I should find RSS material that the program has downloaded, should it ever download it.

short story: where am I looking, and what am I looking for?

Revision history for this message
Brian D (turbo) wrote :

Christophe -

I fired up the client from a terminal session, and found the following on stdout:

-------------------------------------------------------------------------------------------------------------------------------------------------------
Refreshing all rss feeds
Temporary filename is: /tmp/qt_temp.TJ5526
openRss() called
can't read temp file, might be empty
OpenRss: Feed update Failed
stream http://ezrss.it/feed : loaded=false
Getting the list of news
Got the list of news
Added all news to the GUI
First news selected
Temporary filename is: /tmp/qt_temp.XM5526
openRss() called
can't read temp file, might be empty
OpenRss: Feed update Failed
stream http://www.bt-chat.com/rss.php?mode=cg&group=3&cat=9 : loaded=false
Getting the list of news
Got the list of news
Added all news to the GUI
First news selected
Could not download icon at http://ezrss.it/favicon.ico, reason: The remote content was not found at the server (404)
Temporary filename is: /tmp/qt_temp.Lh5526
-------------------------------------------------------------------------------------------------------------------------------------------------------

...interesting, that the messages seem to indicate that the news has been added to the GUI, but nothing is ever displayed on the GUI. ...and the tmp files cannot be read.

the other temp file, for the bt-chat RSS feed, is created in tmp and is not 0 bytes:
-------------------------------------------------------------------------------------------------------------------------------------------------------
-rw------- 1 brian 894 2010-01-26 22:46 qt_temp.Lh5544
-------------------------------------------------------------------------------------------------------------------------------------------------------

...and appears to be 894 bytes of binary data not at all resembling an RSS feed. (maybe it was the favicon ?)

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

Ok. We are getting somewhere.

I checked the code and the problem seems to be that QtXml is not able to parse the RSS document (which is XML). I'm attaching a patch which will:
- Print more debug information in the terminal (line and column or the parsing error as well as the error message)
- Do not delete the downloaded RSS stream from /tmp so that we can have a look at it.

Could you please apply it? (using something like "patch -i rss_debug.patch")
Then get the debug output and the tmp file.

Changed in qbittorrent:
assignee: nobody → Christophe Dumez (hydr0g3n)
status: New → Incomplete
Revision history for this message
Christophe Dumez (hydr0g3n) wrote :
Revision history for this message
Brian D (turbo) wrote :

sure, no problem. I will apply the patch and let you know what we get, this evening when I return home from work.

Revision history for this message
Brian D (turbo) wrote :

...also, is this normal? (from ~/.config/qBittorrent/qBittorrent.conf):

[Rss]
streamList=http://ezrss.it/feed, "http://rss.bt-chat.com/?group=3&cat=9"
streamAlias=http://ezrss.it/feed, "http://rss.bt-chat.com/?group=3&cat=9"
open_folders=@Invalid()

 -- should it be a comma-separated list of feeds, followed by a comma-separated list of aliases?

(PS: there's no way within the UI to set the alias; the dialog asks only for a URL, then creates the RSS entry)

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

Yes. I have the same format in my config file. This is handled by Qt4 so this is not the issue.

Regarding the alias: Simply right-click on a feed name and choose "Rename" action.

I'm waiting on your feedback with the patch to understand why the RSS feed cannot be parsed.

Revision history for this message
Brian D (turbo) wrote :

understood. I'm at the office now, so that'll have to wait until I return home this evening.

Revision history for this message
Brian D (turbo) wrote :

Christophe --

patched, compiled, and installed. Here's the output:

Refreshing feed: http://ezrss.it/feed
stream http://ezrss.it/feed : loaded=true
Downloading http://ezrss.it/feed...
Downloading http://ezrss.it/favicon.ico...
Temporary filename is: /tmp/qt_temp.h10770
openRss() called
Error when parsing XML at line 1 (col: 1): unexpected end of file
OpenRss: Feed update Failed
stream http://ezrss.it/feed : loaded=false
Getting the list of news
Got the list of news
Added all news to the GUI
First news selected
Could not download icon at http://ezrss.it/favicon.ico, reason: The remote content was not found at the server (404)

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

And what about the temporary file, can you attach it? /tmp/qt_temp.h10770 in your output.

Revision history for this message
Brian D (turbo) wrote :

I didn't attach it because, outside of the filename, there was no information. The file was 0 bytes in length.

Revision history for this message
Brian D (turbo) wrote :
Download full text (7.9 KiB)

...here's the relevant directory listing from my /tmp folder overnight:

-rw------- 1 brian 0 2010-01-27 19:08 qt_temp.J10770
-rw------- 1 brian 0 2010-01-27 19:10 qt_temp.M10770
-rw------- 1 brian 0 2010-01-27 19:11 qt_temp.h10770
-rw------- 1 brian 0 2010-01-27 19:16 qt_temp.J10800
-rw------- 1 brian 0 2010-01-27 19:21 qt_temp.h10800
-rw------- 1 brian 0 2010-01-27 19:27 qt_temp.S10800
-rw------- 1 brian 0 2010-01-27 19:31 qt_temp.n10800
-rw------- 1 brian 0 2010-01-27 19:36 qt_temp.i10800
-rw------- 1 brian 0 2010-01-27 19:41 qt_temp.Z10800
-rw------- 1 brian 0 2010-01-27 19:46 qt_temp.T10800
-rw------- 1 brian 0 2010-01-27 19:52 qt_temp.d10800
-rw------- 1 brian 0 2010-01-27 19:56 qt_temp.C10800
-rw------- 1 brian 0 2010-01-27 20:01 qt_temp.f10800
-rw------- 1 brian 0 2010-01-27 20:06 qt_temp.K10800
-rw------- 1 brian 0 2010-01-27 20:11 qt_temp.W10800
-rw------- 1 brian 0 2010-01-27 20:16 qt_temp.X10800
-rw------- 1 brian 0 2010-01-27 20:21 qt_temp.b10800
-rw------- 1 brian 0 2010-01-27 20:26 qt_temp.j10800
-rw------- 1 brian 0 2010-01-27 20:31 qt_temp.E10800
-rw------- 1 brian 0 2010-01-27 20:36 qt_temp.L10800
-rw------- 1 brian 0 2010-01-27 20:41 qt_temp.c10800
-rw------- 1 brian 0 2010-01-27 20:46 qt_temp.F10800
-rw------- 1 brian 0 2010-01-27 20:51 qt_temp.q10800
-rw------- 1 brian 0 2010-01-27 20:56 qt_temp.a10800
-rw------- 1 brian 0 2010-01-27 21:01 qt_temp.e10800
-rw------- 1 brian 0 2010-01-27 21:06 qt_temp.V10800
-rw------- 1 brian 0 2010-01-27 21:11 qt_temp.g10800
-rw------- 1 brian 0 2010-01-27 21:16 qt_temp.k10800
-rw------- 1 brian 0 2010-01-27 22:13 qt_temp.J11687
-rw------- 1 brian 0 2010-01-27 22:18 qt_temp.M11687
-rw------- 1 brian 0 2010-01-27 22:23 qt_temp.h11687
-rw------- 1 brian 0 2010-01-27 22:28 qt_temp.S11687
-rw------- 1 brian 0 2010-01-27 22:34 qt_temp.n11687
-rw------- 1 brian 0 2010-01-27 22:38 qt_temp.i11687
-rw------- 1 brian 0 2010-01-27 22:43 qt_temp.w11687
-rw------- 1 brian 0 2010-01-27 22:49 qt_temp.T11687
-rw------- 1 brian 0 2010-01-27 22:54 qt_temp.C11687
-rw------- 1 brian 0 2010-01-27 22:58 qt_temp.f11687
-rw------- 1 brian 0 2010-01-27 23:04 qt_temp.K11687
-rw------- 1 brian 0 2010-01-27 23:09 qt_temp.F11687
-rw------- 1 brian 0 2010-01-27 23:13 qt_temp.x11687
-rw------- 1 brian 0 2010-01-27 23:18 qt_temp.Z11687
-rw------- 1 brian 0 2010-01-27 23:23 qt_temp.t11687
-rw------- 1 brian 0 2010-01-27 23:29 qt_temp.P11687
-rw------- 1 brian 0 2010-01-27 23:34 qt_temp.aa1687
-rw------- 1 brian 0 2010-01-27 23:38 qt_temp.a11687
-rw------- 1 brian 0 2010-01-27 23:43 qt_temp.V11687
-rw------- 1 brian 0 2010-01-27 23:49 qt_temp.q11687
-rw------- 1 brian 0 2010-01-27 23:53 qt_temp.U11687
-rw------- 1 brian 0 2010-01-27 23:59 qt_temp.s11687
-rw------- 1 brian 0 2010-01-28 00:04 qt_temp.G11687
-rw------- 1 brian 0 2010-01-28 00:08 qt_temp.j11687
-rw------- 1 brian 0 2010-01-28 00:14 qt_temp.Q11687
-rw------- 1 brian 0 2010-01-28 00:19 qt_temp.o11687
-rw------- 1 brian 0 2010-01-28 00:24 qt_temp.W11687
-rw------- 1 brian 0 2010-01-28 00:28 qt_tem...

Read more...

Revision history for this message
Brian D (turbo) wrote :

Christophe --

Okay, I found the problem. I had to trick the program to fix it, but it's fixed.

Under version 1.2.1, I had added "http://ezrss.it/feed", and it worked just fine. When I upgraded to 2.1.2, all the previous settings were preserved (and, btw, considering a lot of config files and such moved around between those versions, THANK YOU for putting in the extra work to find/move the old ones to the new locations!!).

At this point, we were stumped, because the feed was working in 1.2.1, and was now silent in 2.1.2. I typed "http://ezrss.it/feed" into my browser (more than once!), and it worked fine. Then, yesterday afternoon, I noticed that the URL in the browser window read "http://ezrss.it/feed/" -- subtle, but different. ;-)

Here's where your program bug lies - in 1.2.1, and in nearly any program that handles HTTP traffic (firefox, wget, etc), the URL would return the 'http://ezrss.it/feed/' page when 'http://ezrss.it/feed' was requested. In 2.1.2, this doesn't happen, and it returns a 404 (not found) error instead.

So, part 1 of the problem: restore URL resolution to function as it did in earlier versions of qBitTorrent - it was handling it correctly before, now it is not.

Here's part 2: if you attempt to change the URL within qBitTorrent's UI, it will not let you add that trailing backslash to the URL, and keeps what you had there. Further, if you attempt to create a new RSS feed with the corrected URL, it complains that you already have that feed defined, and will not create the new one. Obviously, if you fix part 1, this issue is less problematic.

In increasingly minor order, here's part 3: the program _assumes_ everything is okay with the fetch and merrily plods along, creating a temp file, writing 0 bytes to it, then finally fails when it tries to read from that file and discovers that there are 0 bytes of XML to parse through... it really should have detected/reported this issue earlier in the program flow.

To get around part 2, I exited the program (because if you do this while the program is running, your changes are overwritten when the program exits) and manually edited ~/.config/qBittorrent/qBittorrent.conf, manually adding the trailing backslash to the ezRSS feed, then restarted qBitTorrent. Almost immediately, the ezRSS feed window was filled with news articles (torrents).

So, 18 comments later, and the issues are identified, a work-around is in place, and things are moving forward...

Thank you very much, Christophe, for your attention to this issue -- a lot of developers are much less responsive to the end-users, and issues may take many months to correct. I am delighted that you are *truly* active in development and support of this program.

I'm going to back out that patch, reset the DEBUG level, and recompile & reinstall... and look forward to seeing what new enhancements the next version of qBitTorrent brings.

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

You're right! I can reproduce it here. I'm working on fixing this. I cannot go back to the way it was in qBittorrent v1.2 because I no longer use libcurl to download files, I use Qt-specific classes instead. I'm pretty sure I can make the Qt classes work in this case though: I'm on it.

Changed in qbittorrent:
importance: Undecided → Medium
milestone: none → 2.1.3
status: Incomplete → In Progress
Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

This is fixed in SVN. Thanks!

The problem was that Qt HTTP downloader class does not follow redirections (for security reasons). I need to detect that it should be redirected and download for the updated URL instead. It works fine now.

Changed in qbittorrent:
status: In Progress → Fix Committed
summary: - RSS feeds not refreshing
+ Missing support for HTTP redirect (Error 301)
Changed in qbittorrent:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.