HTTrack Website Copier
Free software offline browser - FORUM
Subject: C buffers Vs. C++ STL
Author: Jean-Marc Molina
Date: 11/05/2004 00:15
 
Hello,

I wrote a PHP script to quickly generate a winprofile.ini
file for HTTrack. I hoped it would allow me to download
about 500 URLs using the CurrentUrl option of the
configuration file. However HTTrack can't open the project
without crashing. So I made a few adjustements and found out
HTTrack was crashing because of the file length. If I add a
new URL to the CurrentURL string, it crashes, if I remove
it, it works. So I guess it crashes because of C buffers
limitation used by HTTrack to open the configuration file.
For example I found these kind of lines everywhere :
«     char line1[1024];
    char line[8192];
    char line2[1024]; »

It seems the line buffer is used to store the whole
configuration file, then it's parsed. I can't really figure
out what makes it crash, the CurrentUrl line, the whole
file... Actually its 4 297 bytes large, so at first I
thought about a 4096 limitation but the buffer is 8192 large...

But as my file was generated by a script, not by HTTrack, I
thought I should try to manually insert the URLs, using
WinHTTrack. From the working project, HTTrack was able to
list about 50 URLs. I manually added 10 URLs and close the
project, HTTrack wasn't able to reopen the project without
crashing, but I was able to manually add my URLs.

I used to develop C programs so I know its limitations, my
advice would be to port HTTrack to C++ to avoid all these
limitations, at least use STL to handle all the memory
allocations, you wouldn't have to allocate 8192 or 1024
bytes, you would be able to use a buffer.

JM

PS : I think you should hide our mails and allow us to
subscribe to the forum, email grabbers don't care anymore
about encoded mails, specially when there are noscript tags
everywhere... For example they would replace you « username
at host dot com » by « username@hots.com », regular
expressions wonders :).
 
Reply


All articles

Subject Author Date
C buffers Vs. C++ STL

11/05/2004 00:15
Re: C buffers Vs. C++ STL

11/07/2004 09:43
Re: C buffers Vs. C++ STL

11/12/2004 14:01




6

Created with FORUM 2.0.11