#!/usr/local/bin/perl # # CGI script to supply a specified file after reading a password from a form # $query_string = $ENV{'QUERY_STRING'}; $path_info = $ENV{'PATH_INFO'}; $expected = $ENV{'CONTENT_LENGTH'}; $secret = "fido"; read(STDIN, $inputline, $expected); ($userpw) = $inputline =~ /^userinput=([\w]+)$/; if ($userpw eq $secret) { print "Content-type: text/html\n\n"; print STDOUT <<"EOM"; <HTML> <HEAD> <TITLE>Building an Internet Server</TITLE> <BASE HREF="http://ruff.cs.umbc.edu:1080/"> </HEAD> <BODY> <H1>Building an Internet Server</H1> <UL> <LI> On Windows, we can use HTML Assistant to create HTML documents. <B>Exercise 1</B> Use <TT>pkunzip</TT> to build this tool. <LI> In the X environment, we might want to use use SoftQuad's HoTMetaL. If you have a postscript viewer installed, you can take a look at this postscript file showing a <A HREF="http://ruff.cs.umbc.edu:1080/courses/491/handouts/sqhm.ps">screendump from SoftQuad's HoTMetaL program</A> <LI> The X version of emacs, <TT>xemacs</TT>, has an HTML mode that is automatically entered when a document with the <TT>.html</TT> suffix is visited. <LI> Several versions of HTML are available. Softquad's HoTMetaL program seems to recognize ordinary HTML. I've noticed that HoTMetal gets <EM>really grumpy</EM> about even modest deviations from the syntax of HTML. You might want to look at the <A HREF="http://www.w3.org/hypertext/WWW/MarkUp/html3/CoverPage.html">HTML Specification</A> page that documents HTML 3.0. <LI> <B>Exercise 2</B> Use HTML Assistant, or an ordinary editor if you wish, to create a home page for yourself. <a href="http://ruff.cs.umbc.edu:1080/courses/491/html/exercise1.html">Build Your Own Home Page</a> </UL> <LI> <B>Break</B> <LI> If UNIX accounts are available, we can try the <A HREF="http://wsk.eit.com/wsk/doc/">Webmaster Starter Kit</A>, which makes installation of a basic UNIX server a snap. Otherwise, I'll just demonstrate it. <LI>Yahoo has a whole section devoted to <A HREF="http://akebono.stanford.edu/yahoo/Computers/World_Wide_Web/" >WWW topics</A>.</LI> <LI> HTML style and content. Look at the <A HREF="http://info.med.yale.edu/caim/StyleManual_Top.HTML">Yale HTML Style Guide</A>. <LI> There's a brand new <A HREF="http://www.sun.com/sun-on-net/www.sun.com/uidesign/">Interface Design Document from Sun</A> <LI> For quick reference to HTML, see the <A HREF="http://www.access.digex.net/~werbach/barebone.html">Bare Bones Guide to HTML</A>. </UL> <H2>Day 2: Using HTML</H2> <H3>Objectives</H3> <UL> <LI> Install a Web server on Windows <LI> Cover more HTML: forms and scripts </UL> <H3>Morning Session</H3> <UL> <LI> There are a number of servers out there. The most popular UNIX servers are from NCSA and CERN. As shown in this <A HREF="http://www.proper.com/www/servers-chart.html">server comparison chart</A>, servers vary widely in their platforms and features. <LI> The two most popular Web servers for UNIX are the NCSA Server and the CERN Server. The CERN Server is being maintained by the <A HREF="http://www.w3.org/">World Wide Web Consortium</A>. <LI> There are several servers available for Windows. <a href="http://www.city.net/win-httpd/">Windows server documentation.</a> <LI> Greg Bean has lots of <a href="http://www.charm.net/~cyber> information on DOS/Windows web software</a>, including a tutorial on <a href="http://www.charm.net/~cyber/slide01.html>Building Web Servers on Microcomputer Platforms.</a> <LI> Demonstrate installation of a web server under Windows. <LI> We can look at the directory setup for the NCSA and CERN servers by making a <A HREF="telnet://ruff.cs.umbc.edu">telnet connection to ruff.cs.umbc.edu</A>. Note that although the various servers may use a different directory structure, the basic idea is the same. Using <TT>websk</TT> as an example, we have: <UL> <LI> The <TT>bin</TT> directory, which is where the <TT>httpd</TT> executable resides. <LI> Scripts, written using the GET or POST method for taking input, reside in the <TT>cgi-bin</TT> directory. The CERN server, and the NCSA server, keep GET and POST scripts in different directories. (The GET method is where the input data for a script is appended to the script's URL. In the POST method, the script reads its input data off stdin.) <LI> The <TT>cgi-bin/admin</TT> directory contains some <TT>html</TT> files and scripts for administering the server. This directory is peculiar to <TT>websk</TT>, although similar tools may exist for other servers. Scripts used by servers tend to be written in perl, shell language, or compiled C code. <LI> The <TT>conf</TT> directory contains several configuration files. Errors in these files may result in flaky server behavior, especially under Windows. <TT>access.conf</TT> specifies the IP addresses of those machines that may or may not issue GET or PUT commands to your server. <TT>httpd.conf</TT> describes the server itself, e.g. what TCP/IP port it's supposed to listen to. <TT>srm.conf</TT> tells the server where to find icons and scripts. The file <TT>mime.types</TT> tells the server what MIME type to attach to files with a given suffix. <LI> The <TT>html</TT>documents themselves reside under <TT>websk/doc</TT>. <LI> The <TT>icons</TT> directory is where icons used in the IMG tag are kept. The most common formats are <TT>xbm</TT> for black and white, and <TT>gif</TT> for color icons. <LI> The <TT>logs</TT> directory is where the server keeps its access and error logs. </UL> <LI> <B>Break</B> <LI> <B>Exercise 3</B> Bring up a server on your PC, and configure it to bring up the home page you created yesterday. <LI> Shopping for an Internet Provider - for you or your server. <LI> Using the Net from home --- options such as TIA and SlipKnot. </UL> <H3>Afternoon Session</H3> <UL> <LI> UNIX servers are freely available from NCSA or CERN. The <A HREF="http://hoohoo.ncsa.uiuc.edu/docs/Overview.html" >NCSA server</A> is smaller, and easier to install. Pathnames in several configuration files have to be changed to reflect local directories. (The Webmaster's Starter Kit does this for you, but I think the basic websk configuration lacks support for image maps.)</LI> <LI> There is lots of <A HREF="http://hoohoo.ncsa.uiuc.edu/index.html"> information on installing the NCSA server</A>. Pre-compiled binaries are available for many platforms, or we can build compile it ourselves. <LI> Several of the popular browsers support forms, including Lynx and NCSA Mosaic. The <A HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/overview.html" >Mosaic documentation for forms</A> is quite useful.</LI> <LI>I'm running the CERN server on ruff.cs port 3080. We can see a couple of forms from <A HREF="http://ruff.cs.umbc.edu:3080/homepage.html"> my homepage</A>, and see the corresponding server-side scripts by making a <A HREF="telnet://ruff.cs.umbc.edu">telnet connection to ruff.cs.umbc.edu</A>. Recall that the <A HREF="http://ruff.cs.umbc.edu:1080/newpw_form.html">"password form"</A> uses a simple form. <LI><B>Break</B> <LI> <B>Exercise 4</B> Create a fill-out form using HTML. You can test your form by running it against NCSA's form tester, which you can access by specifying <CODE>ACTION="http://hoohoo.ncsa.uiuc.edu/htbin-post/post-query"</CODE> in the FORM tag.</LI> <LI> Forms are usually used in conjunction with scripts. For example, the <A HREF="http://ruff.cs.umbc.edu:1080/newpw_form.html">gateway form</A> is connected to a relatively long script written in perl. To see the whole script, however, we must <A HREF="telnet://ruff.cs.umbc.edu">telnet to ruff</A>. <LI> The server has to be configured to find scripts in a particular directory. For example, on ruff.cs the directory <TT>~nicholas/CERNscript</TT> is where the scripts described above are kept. <LI> This <A HREF="http://ruff.cs.umbc.edu:1080/courses/491/html/date.html">example of a script</A> returns the system date.</LI> <LI>Let's go through this <A HREF="http://hoohoo.ncsa.uiuc.edu:80/cgi/primer.html">tutorial on the Common Gateway Interface</A></LI> <LI> Demonstrate installation of a web server under Windows NT. <LI> If time permits, we can demonstrate the use of image maps and the Windows <TT>mapedit</TT> tool. (Otherwise, we'll do that tomorrow.) <LI>The NCSA server keeps separate directories for GET and POST scripts. With the GET method, the arguments are appended to the requested URL. With the POST method, the arguments are sent as a separate data structure, and read as input by the scripts themselves. Scripts that take no input arguments can be used with either method. <LI> Demonstrate installation of a web server under Windows NT. </UL> <H2>Day 3: Configuring servers</H2> <H3>Objectives</H3> <UL> <LI> More on HTML <LI> Graphics and image maps </UL> <H3>Morning Session</H3> <UL> <LI> For more background on the Web, there are many on-line references. The August 94 Communications of the ACM has a good overview article. <A HREF="http://www.ora.com/">O'Reilly &amp; Associates</A> has several appropriate books. <LI> The related notions of URI, URL, URC, URA and URN are explained on this <A HREF="http://www.w3.org/hypertext/WWW/Addressing/Addressing.html">UR* page</A>. All this continues to be under development.</LI> <LI>The <A HREF="http://www.ncsa.uiuc.edu/SDG/IT94/Agenda/Papers-received.html" >papers from the Fall 1994 Web conference</A> in Chicago are, of course, available on the Web. The papers from the Spring 1995 conference in Darmstadt are available from <A HREF="http://www.elsevier.nl/">Elsevier</A>. <LI> HTML 3, which is under development, will have facilities for tables, equations, and a lot more options in existing tags. Yahoo has <A HREF="http://www.yahoo.com/Computers/World_Wide_Web/HTML/HTML_3_0/"> information on HTML 3</A>. Let's look at the specifications and the SGML DTD. <LI>The <A HREF="http://home.mcom.com/home/services_docs/html-extensions.html" >extensions to HTML used in Netscape</A> include a couple of new tags, and lots of options on exisiting tags. We will see how many other browsers end up supporting these. <LI> Graphics (large and small) are becoming more popular in HTML documents. There are <A HREF="http://white.nosc.mil/images.html">many collections of useful icons</A> out there. <LI> Some of the available graphics include symbols for: <MENU> <LI><IMG SRC="http://ruff.cs.umbc.edu:1080/courses/491/icons/binary.xbm">A binary file <LI><IMG SRC="http://ruff.cs.umbc.edu:1080/courses/491/icons/movie.xbm">A movie </MENU> <LI> Take a look at some of the other image repositories around the Web, and convert some of them for use on your home page. If an image is transparent, then it blends into the browser's background color, no matter what that color is. To see how this works, check out the <A HREF="http://melmac.corp.harris.com/transparent_images.html">Transparent Image Page</A>. Discuss and demonstrate conversion tools such as giftrans. <LI> Some applications with graphics are quite impressive. Here, for example, is the <A HREF="http://www.galcit.caltech.edu:80/~ta/lb/lb.html">lite bright page</A>. <LI>There are several other useful <A HREF="http://hoohoo.ncsa.uiuc.edu/docs/tutorials/" >NCSA httpd tutorials</A>. </LI> <LI>There are a number of wonderful image maps out there. One fine way to use this feature is to make a floorplan of your office or house or whatever. The <A HREF="http://insti.physics.sunysb.edu/itp/floorplan.html"> floorplan of the Physics department at SUNY Stony Brook</A> was the first example. There's an excellent <A HREF="http://wintermute.ncsa.uiuc.edu:8080/map-tutorial/image-maps.html" >tutorial on image maps</A>. </UL> <H3>Afternoon Session</H3> <UL> <LI> If time permits, we can go through some detailed information on <A HREF="http://ruff.cs.umbc.edu:1080/courses/491/html/maps.html">creating image maps</A>. <LI> Demonstrate the <A HREF="http://sunsite.unc.edu/boutell/mapedit/mapedit.html#getmapedit">mapedit</A> tool for creating image maps. <LI> <B>Exercise 5</B> Use mapedit to install an image map under the your server. You may use an image of your own, or we can fetch some suitable images off the net. <LI> Converting a large collection of documents to HTML is a task that <EM>must</EM> be automated to keep one's sanity. Perl scripts are a good way to do this. NASA's <A HREF="http://banzao.gsfc.nasa.gov/stelar/stelar_homepage.html">Stelar Project</A> gave me some insight into this process. <LI> Security on the Web is a big issue for a lot of people. Research in this area is ongoing. One effort has been towards a <A HREF="http://www.commerce.net/information/standards/drafts/shttp.txt" >Secure HTTP</A> protocol. There is also some material on <A HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/security.html" >Mosaic Security Issues</A>.</LI> <LI>There's lots of good information under Yahoo. Performance is an issue for many people, so it's appropriate to consider <A HREF="http://akebono.stanford.edu/yahoo/Computers/World_Wide_Web/Caching/" >caching</A>, and issues related to the TCP/IP protocol used in WWW. We also need to discuss capacity issues. <LI> Issues & Wrapup </UL> <ADDR>This page is the responsibility of <A HREF="http://ruff.cs.umbc.edu:1080/charles_nicholas.html">Charles Nicholas</A>. If you wish, you can send mail to <A HREF="mailto:nicholas\@cs.umbc.edu">nicholas\@cs.umbc.edu</A>. Please note, however, that this mail feature is not (yet) supported by all browsers. </BODY> </HTML> EOM } else { print "Content-type: text/html\n\n"; print "<TITLE>Gateway to Building an Internet Server</TITLE>\n"; print "<PRE>\n"; print "Invalid password.\n"; print "</PRE>\n"; }