Chapter 17. Torture-Testing Web Servers and CGI Scripts

Lincoln D. Stein

It’s a sad fact of life that computer programs aren’t bug free. Loops overwrite array boundaries, memory is mistakenly freed twice, if-then statements make decisions based on random data in uninitialized variables, and while blocks go into endless loops. Perl programmers like ourselves have much to rejoice about because we don’t have to worry about the memory management problems that plague C and C++ programmers. Of course, we have our own idiosyncratic problems, such as inadvertently using a string in a numeric context.

Many of the programs you use on any given day have bugs. Many of the bugs are minor, and most are invisible. You won’t know a program contains a bug until a particular combination of conditions triggers it. For example, a word processing program might work fine for months, and then crash one day when memory is tight and you attempt a global search and replace on a large document.

Bugs are usually just a nuisance. The text editor eats your homework, the printer pours out reams of gibberish, the graphics program flood fills the diagram you’ve labored over for hours with magenta polka dots. When the bug occurs in software that’s part of a web site, however, the consequences can be more frightening. A bug in a web server can cause it to crash, making the site unavailable until someone notices and reboots the server. A bug in a CGI script or server module may cause the browser to display a bewildering ...

Get Web, Graphics & Perl/Tk Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.