I came across this problem once. I wrote a FULL clone to the Conference Room IRCd in mIRC. which did httpd, its own cgi format for httpd, ircd, services for ircd, link support, etc. I ended up splitting it up into like 5 or 6 seperate files because of this bug.