496: Advanced Networking and Web Systems¶
Capstone-level exploration of network protocols, server configuration, and early web technologies.
Topics¶
TCP/IP networking: BOOTP and DHCP protocol implementation
HTTP server configuration (Apache
httpd)CGI scripting with Perl
Network boot infrastructure
Projects¶
BOOTP/DHCP Client (496/bootp.c, 496/bootp.pl)¶
Implements a BOOTP/DHCP client in both C and Perl. Constructs and broadcasts UDP discovery packets, parses server responses to obtain IP addresses, subnet masks, and gateway information, and applies the configuration to the local interface.
#!/usr/local/bin/perl
# Perl BOOTP client — broadcast request, parse reply
$BOOTP_PORT = 67;
$socket = IO::Socket::INET->new(Proto => 'udp', Broadcast => 1);
# Build a minimal BOOTP request packet (RFC 951)
$packet = pack("CCCCNnna4a4a4a4a16a64a128",
1, # op: BOOTREQUEST
1, # htype: Ethernet
6, # hlen: MAC address length
0, # hops
$xid, # transaction ID
0, 0, # secs, flags
$ciaddr, $yiaddr, $siaddr, $giaddr,
$chaddr, $sname, $file
);
send($socket, $packet, 0, $broadcast);
CGI Web Forms (496/form.pl, 496/search.pl)¶
Early CGI scripts written in Perl to handle HTML form submissions and implement basic search functionality. Demonstrates the CGI request/response cycle, query-string parsing, and dynamic HTML generation predating modern web frameworks.
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
# Read POST body from stdin
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split into name=value pairs and URL-decode each value
foreach $pair (split(/&/, $buffer)) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9]{2})/pack("C", hex($1))/eg;
$form{$name} = $value;
}
# Validate required fields before processing
foreach $var (@required_vars) {
if (!$form{$var}) {
print "<h1>Error: please fill in the '$var' field.</h1>\n";
exit;
}
}
Apache Configuration (496/httpd.conf, 496/access.conf, 496/srm.conf)¶
Configuration files for an Apache 1.x HTTP server, including virtual host setup, directory access control, and MIME type mappings.
# httpd.conf — core server settings (NCSA HTTPd / Apache 1.x)
ServerType standalone
Port 90
ServerRoot /usr/local/etc/httpd
# srm.conf — resource map
DocumentRoot /usr/local/etc/httpd/htdocs
DirectoryIndex index.html
# access.conf — directory access control
<Directory /usr/local/etc/httpd/htdocs>
Options Indexes FollowSymLinks
AllowOverride None
order allow,deny
allow from all
</Directory>