Valhalla Legends Forums Archive | Web Development | [PHP] Question

AuthorMessageTime
bethra
Ok, I'll first give some background on the project I'm doing.

My University has basically blocked students from being able to DL .torrent files via the web.  So a simple way to bypass this is to put the .torrent file in somekind of archive/compressed file and downloading it with the help of someone else or having someone else just send the .torrent file over AIM, etc.

So what the project that I'm working on is a HTML webpage that uses PHP to:
1.  Download a specified .torrent file at a given URL to the server temporarily
2.  Archive the .torrent file into some type of compressed file.

Now briefly looking over the PHP Zlib Compression Functions and Bzip2 Compression Functions, I was wondering if anyone familiar with either of the two of the two compression functions knows if I can simply skip having to do step 1.

Thanks
March 28, 2006, 1:05 AM
Topaz
Have you tried just telling the server to download the torrent, rewrite the extension, and send it on to you?
March 28, 2006, 7:12 AM
bethra
@Topaz yup, tried that.


I've figured out how to do what I need, w/o having to do step 1.
[code]
function compress( $srcFileName, $dstFileName )
{
$fp = fopen($srcFileName, "rb");
$data = '';

while (!feof($fp)) {
$data .= fread($fp, 8192);
}

fclose($fp);

if(!file_exists($dstFileName)){
$zp = gzopen( $dstFileName, "w9" );
gzwrite( $zp, $data );
gzclose( $zp );
}else{
return false;
}

return true;
}
[/code]
March 28, 2006, 7:31 AM
SecretShop
id recommend, downloading, compressing, and printing all in one swoop instead of trying to save the file.  I beleve gzip format can compress a stream.
March 30, 2006, 5:34 AM
JoeTheOdd
I bet the filter has something to do with checking the magic bytes in the torrent file, and thats what causes the file to not download even if it's no longer a .torrent. Try changing the magic bytes and writing a small processing program to change it back to normal on the other end, asuming this isn't working out.
March 30, 2006, 3:58 PM
SecretShop
[quote author=J link=topic=14604.msg149400#msg149400 date=1143734308]
I bet the filter has something to do with checking the magic bytes in the torrent file, and thats what causes the file to not download even if it's no longer a .torrent. Try changing the magic bytes and writing a small processing program to change it back to normal on the other end, asuming this isn't working out.
[/quote]

The reason to use compression over some other kind of change to the file would be that its not uncommon for browsers to understand gzip streams.  You could also use https protocol so the filter cannot read whats in the data you are sending, either way would work.
March 31, 2006, 1:33 AM
JoeTheOdd
School filters are built tough. I've never tried, but I bet if you used HTTPS it'd just MITM you and still block it.
March 31, 2006, 3:21 PM
bethra
No, they are only checking for .torrent.  I am able to put the .torrent file in a .gz and download the file.
April 4, 2006, 12:27 AM
Topaz
[quote author=Sorc.Polgara link=topic=14604.msg149721#msg149721 date=1144110466]
No, they are only checking for .torrent.  I am able to put the .torrent file in a .gz and download the file.
[/quote]

So uh, progress or what?
November 7, 2006, 7:19 AM
Ersan
You don't need to do all that, the traffic shaper is probably just checking for the mime type header and file extension, rewrite it.
November 26, 2006, 3:38 AM
Arta
My $0.02: An easier approach might be to base64 encode it. Less dependencies, simpler code and less resource-intensive.
January 10, 2007, 12:57 AM
Ersan
Won't do anything if it's checking mimetypes...

Also will increase the filesize by about 1.37 times the original, all in all a pretty bad idea.
March 26, 2007, 11:46 AM
warz
[quote author=Ersan link=topic=14604.msg167266#msg167266 date=1174909602]
Won't do anything if it's checking mimetypes...

Also will increase the filesize by about 1.37 times the original, all in all a pretty bad idea.
[/quote]

oh my god? so, you're saying instead of having to download a 4 kb file, the file will end up being like.. 5.5 kb? say it aint so. on the flip side, yeah, just check the damn mime type.
March 30, 2007, 7:46 PM
Ersan
Who the fuck said the file was 4kb...

100kb versus 137kb is alot in a high traffic situation, plus the unnecessary overhead in cpu time...  Besides the fact that it wouldn't solve the problem in any way whatsoever because Arta has no clue how mime encapsulation or traffic shapers work (and consequentially, web servers and browsers in general), it was a stupid idea.

'Checking' the mime type on his end doesn't do anything, it needs to be changed...
March 30, 2007, 7:48 PM
warz
[quote author=Ersan link=topic=14604.msg167450#msg167450 date=1175284106]
Who the fuck said the file was 4kb...

100kb versus 137kb is alot in a high traffic situation, plus the unnecessary overhead in cpu time...  Besides the fact that it wouldn't solve the problem in any way whatsoever because Arta has no clue how mime encapsulation or traffic shapers work (and consequentially, web servers and browsers in general), it was a stupid idea.

'Checking' the mime type on his end doesn't do anything, it needs to be changed...
[/quote]

torrent files.. i've yet to see a torrent file be as big as 100 kb. even the most popular torrent on isohunt.com right now, lost, with tons of trackers, is only 30 kb. and obviously when i said check the mime type, i was referring to the idea that you'd probably change it after checking it, if need be.
March 30, 2007, 8:04 PM
Ersan
If you knew how torrent files work, you'd know that they can be as big as hundreds of megabytes depending on the piece size and size of files they have hashed...  Tracker addresses barely take up any space.
March 31, 2007, 12:40 AM
crankycefx
I download my torrent files via lynx from a server in the states, then scp it to the machine I download from.
To get around traffic shaping, I use encryption.
March 31, 2007, 12:49 AM
JoeTheOdd
Dear [s]shithead[/s] Ersan,

Arta was replying strictly to my post about magic bytes, in which case it would work.

Love, Joe.
April 10, 2007, 4:25 AM
Ersan
Hey joe, you dumbfuck, they haven't used magic bytes since 1996, and there's sure as fuck no magic bytes in torrent files, and no traffic shaper in the history of the world has ever shaped based on "magic bytes" as that's just completely fucking retarded - learn your shit before you make idiotic and irrelevant comments.  I'm pretty sure everyone who knows anything about the actual problem disregarded your dumbass post because of how stupid it was, and consequentially I fucking guarantee you arta wasn't responding to your idiocy.  Arta might be wrong but you take the dumbass award.  For the love of God take your self-righteous whiney jesus-boy shit elsewhere.

Thanks, Someone who isn't a complete and utter moron.
April 10, 2007, 8:17 PM

Search