Re: [Qbittorrent-devel] Download from url problem on Windows
A free and reliable P2P BitTorrent client
Brought to you by:
sledgehammer999
From: Peter K. <pee...@us...> - 2007-12-12 01:03:57
|
Op dinsdag 11 december 2007, schreef Chris: > After some time spent debugging I progressed (a little) on the problem > concerning downloadFromUrl on Windows. > > In fact, the torrent files are downloaded actually on Windows, if I open > the downloaded torrent file with vim, it looks like a real torrent. > However, qBittorrent (nor any other bittorrent client) won't open it. > > I decided to download the torrent file using firefox this time in order to > compare the files. When opened with vim, they look identical. However, diff > says they are different (what we can't actually see the diff because > torrent files are binaries) and their size is different: > > chris@chris-laptop:~/devel/qbittorrent/trunk$ ls -l > /home/chris/Bureau/*.torrent > -rw-r--r-- 1 chris chris 18955 2007-12-11 22:39 > /home/chris/Bureau/testGood.torrent > -rw-r--r-- 1 chris chris 19015 2007-12-11 22:37 > /home/chris/Bureau/test.torrent > > Does someone have any idea of the different. To write the torrent files on > the disk, I use fwrite() standard C function that is supposed to be > portable. I can't understand why the file downloaded on Linux is good > although the one downloaded on Windows is not. Maybe We should not use > fwrite and we should write a function specific to Windows that we are sure > will do the job correctly. However, I never developped on Windows. > > Something strange too is that only binary files fail. RSS is using the same > download function are RSS feeds are displayed correctly on Windows. Any > idea is welcome. > > Regards, > Chris. Hi Chris, Viewing in a hexeditor reveals that test.torrent has \r\n line endings and testGood.torrent has \n line endings. I suspect that you need to tell libcurl to always download in binary mode, or turn of any conversion that might be going on. Peter |