home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Magazine / wwwoffle-2.1.tar.gz / wwwoffle-2.1 / messages.c < prev    next >
C/C++ Source or Header  |  1998-03-02  |  18KB  |  602 lines

  1. /***************************************
  2.   $Header: /home/amb/wwwoffle/RCS/messages.c 2.24 1998/03/02 15:05:59 amb Exp $
  3.  
  4.   WWWOFFLE - World Wide Web Offline Explorer - Version 2.1.
  5.   Messages that the program sends in reply to requests from browsers
  6.   ******************/ /******************
  7.   Written by Andrew M. Bishop
  8.  
  9.   This file Copyright 1996,97,98 Andrew M. Bishop
  10.   It may be distributed under the GNU Public License, version 2, or
  11.   any higher version.  See section COPYING of the GNU Public license
  12.   for conditions under which this file may be redistributed.
  13.   ***************************************/
  14.  
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18.  
  19. #include <unistd.h>
  20.  
  21. #include "wwwoffle.h"
  22. #include "misc.h"
  23. #include "config.h"
  24.  
  25.  
  26. /*++++++++++++++++++++++++++++++++++++++
  27.   A fatal server error occured.
  28.  
  29.   int fd The file descriptor to report the error to.
  30.  
  31.   char *string The message string of the error.
  32.   ++++++++++++++++++++++++++++++++++++++*/
  33.  
  34. void ServerError(int fd,char *string)
  35. {
  36.  char *head=
  37.  "HTTP/1.0 500 WWWOFFLE Server Error\r\n"
  38.  "Content-type: text/html\r\n"
  39.  "\r\n"
  40.  "<HTML>\n"
  41.  "<HEAD>\n"
  42.  "<TITLE>WWWOFFLE - Server Error</TITLE>\n"
  43.  "</HEAD>\n"
  44.  "<BODY>\n"
  45.  "<H1 align=center>WWWOFFLE Server Error</H1>\n"
  46.  "<p align=center>\n"
  47.  "The WWWOFFLE server encountered a fatal error\n"
  48.  "<br><b><tt>\n";
  49.  char *tail=
  50.  "\n"
  51.  "</tt></b>\n"
  52.  "</BODY>\n"
  53.  "</HTML>\n";
  54.  
  55.  write_string(fd,head);
  56.  write_string(fd,string);
  57.  write_string(fd,tail);
  58. }
  59.  
  60.  
  61. /*++++++++++++++++++++++++++++++++++++++
  62.   The connection to the remote host failed.
  63.  
  64.   int fd The file descriptor to send the message to.
  65.  
  66.   URL *Url The url that failed.
  67.  
  68.   char *reason The reason for the error.
  69.  
  70.   int cache Set to 1 if this is to be written to the cache (rather than browser).
  71.  
  72.   int backup Set to 1 if there is a backup that we can revert to.
  73.   ++++++++++++++++++++++++++++++++++++++*/
  74.  
  75. void RemoteHostError(int fd,URL *Url,char *reason,int cache,int backup)
  76. {
  77.  char *head=
  78.  "HTTP/1.0 503 WWWOFFLE Remote Host Error\r\n" /* This line must not be changed (see wwwoffles.c). */
  79.  "Content-type: text/html\r\n"
  80.  "\r\n"
  81.  "<HTML>\n"
  82.  "<HEAD>\n"
  83.  "<TITLE>WWWOFFLE - Remote Host Error</TITLE>\n"
  84.  "</HEAD>\n"
  85.  "<BODY>\n"
  86.  "<H1 align=center>WWWOFFLE Remote Host Error</H1>\n"
  87.  "<p align=center>\n"
  88.  "Your request for URL\n"
  89.  "<br><b><tt>\n";
  90.  char *middle1=
  91.  "\n"
  92.  "</tt></b><br>\n"
  93.  "failed because\n"
  94.  "<br><b>\n";
  95.  char *middle2=
  96.  "</b>\n";
  97.  char *middle3=
  98.  "<p>\n"
  99.  "This error message has now been deleted from the cache\n";
  100.  char *middle4a=
  101.  "<br>\n"
  102.  "Reloading this page will cause it to be re-requested.\n";
  103.  char *middle4b=
  104.  "<br>\n"
  105.  "Reloading this page will revert to the previous version.\n";
  106.  char *tail=
  107.  "</BODY>\n"
  108.  "</HTML>\n";
  109.  
  110.  write_string(fd,head);
  111.  write_string(fd,Url->name);
  112.  write_string(fd,middle1);
  113.  write_string(fd,reason);
  114.  write_string(fd,middle2);
  115.  if(cache)
  116.    {
  117.     write_string(fd,middle3);
  118.     if(backup)
  119.        write_string(fd,middle4b);
  120.     else
  121.        write_string(fd,middle4a);
  122.    }
  123.  write_string(fd,tail);
  124. }
  125.  
  126.  
  127. /*++++++++++++++++++++++++++++++++++++++
  128.   Print the message stating that we will get the URL.
  129.  
  130.   int fd The file descriptor to send the message to.
  131.  
  132.   URL *Url The url we were asked to refresh.
  133.   ++++++++++++++++++++++++++++++++++++++*/
  134.  
  135. void CantRefreshPosted(int fd,URL *Url)
  136. {
  137.  char *head=
  138.  "HTTP/1.0 404 WWWOFFLE Cant Refresh Posted\r\n"
  139.  "Content-type: text/html\r\n"
  140.  "\r\n"
  141.  "<HTML>\n"
  142.  "<HEAD>\n"
  143.  "<TITLE>WWWOFFLE - Can't Refresh Posted</TITLE>\n"
  144.  "</HEAD>\n"
  145.  "<BODY>\n"
  146.  "<H1 align=center>WWWOFFLE Can't Refresh Posted</H1>\n"
  147.  "<p align=center>\n"
  148.  "Your request to refresh URL\n"
  149.  "<br><b><tt>\n";
  150.  char *tail=
  151.  "\n"
  152.  "</tt></b><br>\n"
  153.  "failed because it is not possible to refresh pages that result from using the POST method.\n"
  154.  "</BODY>\n"
  155.  "</HTML>\n";
  156.  
  157.  write_string(fd,head);
  158.  write_string(fd,Url->name );
  159.  write_string(fd,tail);
  160. }
  161.  
  162.  
  163. /*++++++++++++++++++++++++++++++++++++++
  164.   Print the message stating that we will get the URL.
  165.  
  166.   int fd The file descriptor to send the message to.
  167.  
  168.   URL *Url The url we are going to get.
  169.  
  170.   int already Set to true if we have already marked this for getting.
  171.   ++++++++++++++++++++++++++++++++++++++*/
  172.  
  173. void WillGetURL(int fd,URL *Url,int already)
  174. {
  175.  char *head1=
  176.  "HTTP/1.0 404 WWWOFFLE Will Get\r\n" /* This line must not be changed (see wwwoffle.c, spool.c). */
  177.  "Content-type: text/html\r\n"
  178.  "\r\n"
  179.  "<HTML>\n"
  180.  "<HEAD>\n"
  181.  "<TITLE>WWWOFFLE - Will Get ";
  182.  char *head2=
  183.  "</TITLE>\n"
  184.  "</HEAD>\n"
  185.  "<BODY>\n";
  186.  char *middle1a=
  187.  "<H1 align=center>WWWOFFLE Request Recorded</H1>\n";
  188.  char *middle1b=
  189.  "<H1 align=center>WWWOFFLE Request Already Recorded</H1>\n";
  190.  char *middle2=
  191.  "<p align=center>\n"
  192.  "Your request for URL\n"
  193.  "<br><b><tt>\n";
  194.  char *middle3=
  195.  "\n"
  196.  "</tt></b><br>\n";
  197.  char *middle4a=
  198.  "has been recorded for download.\n";
  199.  char *middle4b=
  200.  "has already been recorded for download.\n";
  201.  char *middle5=
  202.  "<p align=center>";
  203.  char *middle6a=
  204.  "[<a href=\"http://%s/control/delete?password=%s&req=%s\">Cancel</a>";
  205.  char *middle6b=
  206.  "[<a href=\"http://%s/control/delete?req=%s\">Cancel</a>";
  207.  char *middle7=
  208.  "|Refresh:"
  209.  "<a href=\"http://%s/refresh/?%s\">Options</a>|"
  210.  "<a href=\"http://%s/monitor/?%s\">Monitor</a>]\n"
  211.  "</p>\n";
  212.  char *tail=
  213.  "</BODY>\n"
  214.  "</HTML>\n";
  215.  char *localhost=GetLocalHost(1);
  216.  
  217.  write_string(fd,head1);
  218.  write_string(fd,Url->name);
  219.  write_string(fd,head2);
  220.  if(!already)
  221.     write_string(fd,middle1a);
  222.  else
  223.     write_string(fd,middle1b);
  224.  write_string(fd,middle2);
  225.  write_string(fd,Url->name);
  226.  write_string(fd,middle3);
  227.  if(!already)
  228.     write_string(fd,middle4a);
  229.  else
  230.     write_string(fd,middle4b);
  231.  write_string(fd,middle5);
  232.  if(!already && PassWord)
  233.     write_formatted(fd,middle6a,
  234.                     localhost,HashOutgoingSpoolFile(Url),Url->name);
  235.  else
  236.     write_formatted(fd,middle6b,
  237.                     localhost,Url->name);
  238.  write_formatted(fd,middle7,
  239.                  localhost,Url->name,
  240.                  localhost,Url->name);
  241.  write_string(fd,tail);
  242.  
  243.  free(localhost);
  244. }
  245.  
  246.  
  247. /*++++++++++++++++++++++++++++++++++++++
  248.   Print the message redirecting the user to the real URL when doing a refresh.
  249.  
  250.   int fd The file descriptor to send the message to.
  251.  
  252.   URL *Url The url we are going to get.
  253.   ++++++++++++++++++++++++++++++++++++++*/
  254.  
  255. void RefreshRedirect(int fd,URL *Url)
  256. {
  257.  char *head=
  258.  "HTTP/1.0 301 WWWOFFLE Refresh Redirect\r\n"
  259.  "Content-type: text/html\r\n";
  260.  char *head2=
  261.  "\r\n"
  262.  "<HTML>\n"
  263.  "<HEAD>\n"
  264.  "<TITLE>WWWOFFLE - Refresh Redirect</TITLE>\n"
  265.  "</HEAD>\n"
  266.  "<BODY>\n"
  267.  "<H1 align=center>WWWOFFLE Refresh</H1>\n"
  268.  "<p align=center>\n"
  269.  "Your request for URL\n"
  270.  "<br><b><tt>\n";
  271.  char *middle=
  272.  "\n"
  273.  "</tt></b><br>\n"
  274.  "will be refreshed by selecting the link below.\n"
  275.  "<br>\n";
  276.  char *tail=
  277.  "\n"
  278.  "</BODY>\n"
  279.  "</HTML>\n";
  280.  
  281.  write_string(fd,head);
  282.  write_formatted(fd,"Location: %s\r\n",Url->link);
  283.  write_string(fd,head2);
  284.  write_string(fd,Url->name);
  285.  write_string(fd,middle);
  286.  write_formatted(fd,"<a href=\"%s\">%s</a>",Url->link,Url->name);
  287.  write_string(fd,tail);
  288. }
  289.  
  290.  
  291. /*++++++++++++++++++++++++++++++++++++++
  292.   Print the welcome message for the proxy server.
  293.  
  294.   int fd The file descriptor to send the message to.
  295.   ++++++++++++++++++++++++++++++++++++++*/
  296.  
  297. void WelcomePage(int fd)
  298. {
  299.  char *head=
  300.  "HTTP/1.0 200 WWWOFFLE Welcome Page\r\n"
  301.  "Content-type: text/html\r\n"
  302.  "\r\n"
  303.  "<HTML>\n"
  304.  "<HEAD>\n"
  305.  "<TITLE>WWWOFFLE Version 2.1 - Proxy Welcome Page</TITLE>\n"
  306.  "</HEAD>\n"
  307.  "<BODY>\n"
  308.  "<p align=center>\n"
  309.  "[Top]\n"
  310.  "[<a href=\"#description\">Description</a>]\n"
  311.  "[<a href=\"#indexes\">Cache Indexes</a>]\n"
  312.  "[<a href=\"#request\">Request Pages</a>]\n"
  313.  "[<a href=\"#control\">Control Program</a>]\n"
  314.  "[<a href=\"#links\">Internet Links</a>]\n"
  315.  "</p>\n"
  316.  "<hr>\n"
  317.  "<H1 align=center><a name=\"top\">WWWOFFLE Proxy Welcome Page</a></H1>\n"
  318.  "The WWWOFFLE programs simplify World Wide Web browsing from computers that use\n"
  319.  "intermittent (dial-up) connections to the internet.\n"
  320.  "<h2><a name=\"description\">Description</a></h2>\n"
  321.  "The wwwoffled program is a simple proxy server with special features for use\n"
  322.  "with dial-up internet links.  This means that it is possible to browse web pages\n"
  323.  "and read them without having to remain connected.\n"
  324.  "<br>\n"
  325.  "While Online\n"
  326.  "<ul>\n"
  327.  "<li>Caching of pages that are viewed for review later.\n"
  328.  "<li>Conditional fetching to only get pages that have changed.\n"
  329.  "</ul>\n"
  330.  "While Offline\n"
  331.  "<ul>\n"
  332.  "<li>The ability to follow links and mark other pages for download.\n"
  333.  "<li>Browser or command line interface to select pages for downloading.\n"
  334.  "<li>Optional info on bottom of pages showing cached date and allowing refresh.\n"
  335.  "<li>Works with pages containing forms.\n"
  336.  "<li>Can be configured to use dial-on-demand for pages that are not cached.\n"
  337.  "</ul>\n"
  338.  "Automated Download\n"
  339.  "<ul>\n"
  340.  "<li>Downloading of specified pages non-interactively.\n"
  341.  "<li>Can automatically fetch inlined images in pages fetched this way.\n"
  342.  "<li>Can automatically fetch contents of all frames on pages fetched this way.\n"
  343.  "<li>Automatically follows links for pages that have been moved.\n"
  344.  "<li>Can monitor pages at regular intervals to fetch those that have changed.\n"
  345.  "<li>Makes backup copies of cached pages so server errors don't overwrite them.\n"
  346.  "</ul>\n"
  347.  "Provides\n"
  348.  "<ul>\n"
  349.  "<li>Caching of web pages (http), ftp sites and finger command.\n"
  350.  "<li>An introductory page with information and links to the built-in pages.\n"
  351.  "<li>Multiple indexes of pages stored in cache for easy selection.\n"
  352.  "<li>Interactive or command line control of online/offline status.\n"
  353.  "<li>User selectable purging of pages from cache based on hostname.\n"
  354.  "<li>Interactive or command line option to fetch pages and links recursively.\n"
  355.  "<li>Interactive web page to allow editing of the configuration file.\n"
  356.  "</ul>\n"
  357.  "General\n"
  358.  "<ul>\n"
  359.  "<li>Can be used with one or more external proxies based on hostname.\n"
  360.  "<li>Automates proxy authentication for external proxies that require it.\n"
  361.  "<li>Configurable to still allow use on intranets while offline.\n"
  362.  "<li>Can be configured to block or not cache URLs based on file type or host.\n"
  363.  "<li>Can censor outgoing HTTP headers to maintain user privacy.\n"
  364.  "<li>All options controlled using a simple configuration file.\n"
  365.  "<li>Optional password control for management functions.\n"
  366.  "</ul>\n"
  367.  "<h2><a name=\"indexes\">WWWOFFLE Cache Indexes</a></h2>\n"
  368.  "The index of all of the pages stored in the WWWOFFLE cache is available in a number of formats.\n"
  369.  "<br>\n"
  370.  "The indexes are organised by hostname with a separate list for each host.\n"
  371.  "The basic URL is /index/, but this can be modified with a path as follows.\n"
  372.  "<dl compact>\n"
  373.  "<dt><a href=\"/index/\">/index/</a>\n"
  374.  "<dd>The main index that has links to all of the other indexes.\n"
  375.  "<dt><a href=\"/index/http/?none\">/index/<i>http</i>/</a>\n"
  376.  "<dd>A list of the http pages that are cached (or any other protocol).\n"
  377.  "<dt><a href=\"/index/http/www.gedanken.demon.co.uk/?none\">/index/<i>http</i>/<i>www.gedanken.demon.co.uk</i>/</a>\n"
  378.  "<dd>A list of the http pages that are cached from the host www.gedanken.demon.co.uk (or any other protocol and host).\n"
  379.  "<dt><a href=\"/index/outgoing/?none\">/index/outgoing/</a>\n"
  380.  "<dd>The list of requests waiting to be fetched.\n"
  381.  "<dt><a href=\"/index/monitor/?none\">/index/monitor/</a>\n"
  382.  "<dd>The list of requests for pages that are monitored on a regular basis.\n"
  383.  "<dt><a href=\"/index/lasttime/?none\">/index/lasttime/</a>\n"
  384.  "<dd>The list of pages that were fetched the last time that the program was online.\n"
  385.  "<dt><a href=\"/index/latest/?dated\">/index/latest/</a>\n"
  386.  "<dd>An index of all files modified in the last few days sorted by modification time.\n"
  387.  "</dl>\n"
  388.  "<h2><a name=\"request\">WWWOFFLE Single and Recursive Page Requests</a></h2>\n"
  389.  "Pages that are wanted can be fetched by entering them into the browser's own page selector.\n"
  390.  "Or alternatively by using the command line interface or interactively from a web page.\n"
  391.  "<dl compact>\n"
  392.  "<dt><a href=\"/refresh/\">/refresh/</a>\n"
  393.  "<dd>An interactive page for fetching pages.\n"
  394.  "</dl>\n"
  395.  "<h2><a name=\"control\">WWWOFFLE Interactive Control</a></h2>\n"
  396.  "The WWWOFFLE proxy can be controlled either through a command line interface, or interactively from a web page.\n"
  397.  "<dl compact>\n"
  398.  "<dt><a href=\"/control/\">/control/</a>\n"
  399.  "<dd>An interactive page to control the proxy program.\n";
  400.  char *middle=
  401.  "[Requires the password from the configuration file, but any user name.]\n";
  402.  char *tail=
  403.  "</dl>\n"
  404.  "<h2><a name=\"links\">Further WWWOFFLE Links</a></h2>\n"
  405.  "The WWWOFFLE homepage on the internet is available at\n"
  406.  "<a href=\"http://www.gedanken.demon.co.uk/wwwoffle/index.html\">http://www.gedanken.demon.co.uk/wwwoffle/index.html</a>\n"
  407.  "and contains the latest information about the program in general.\n"
  408.  "<p>\n"
  409.  "The latest information about using this version of WWWOFFLE is on the WWWOFFLE Version 2.1 Users Page at\n"
  410.  "<a href=\"http://www.gedanken.demon.co.uk/wwwoffle/version-2.1/user.html\">http://www.gedanken.demon.co.uk/wwwoffle/version-2.1/user.html</a>\n"
  411.  "and contains more information about using this version of the program.\n"
  412.  "<p>\n"
  413.  "You can e-mail the author at <a href=\"mailto:amb@gedanken.demon.co.uk\">amb@gedanken.demon.co.uk</a>,\n"
  414.  "<i>this is helped if you put wwwoffle in the subject line</i>.\n"
  415.  "<hr>\n"
  416.  "<p align=center>\n"
  417.  "[<a href=\"#top\">Top</a>]\n"
  418.  "[<a href=\"#description\">Description</a>]\n"
  419.  "[<a href=\"#indexes\">Cache Indexes</a>]\n"
  420.  "[<a href=\"#request\">Request Pages</a>]\n"
  421.  "[<a href=\"#control\">Control Program</a>]\n"
  422.  "[<a href=\"#links\">Internet Links</a>]\n"
  423.  "</p>\n"
  424.  "</BODY>\n"
  425.  "</HTML>\n";
  426.  
  427.  write_string(fd,head);
  428.  if(PassWord)
  429.     write_string(fd,middle);
  430.  write_string(fd,tail);
  431. }
  432.  
  433.  
  434. /*++++++++++++++++++++++++++++++++++++++
  435.   Print a message that an illegal page has been requested on the proxy server.
  436.  
  437.   int fd The file descriptor to send the message to.
  438.  
  439.   char *pathargs The path and args that were specified.
  440.   ++++++++++++++++++++++++++++++++++++++*/
  441.  
  442. void IllegalPage(int fd,char *pathargs)
  443. {
  444.  char *head=
  445.  "HTTP/1.0 404 WWWOFFLE Illegal Page\r\n"
  446.  "Content-type: text/html\r\n"
  447.  "\r\n"
  448.  "<HTML>\n"
  449.  "<HEAD>\n"
  450.  "<TITLE>WWWOFFLE - Illegal Page</TITLE>\n"
  451.  "</HEAD>\n"
  452.  "<BODY>\n"
  453.  "<H1 align=center>WWWOFFLE Illegal Page</H1>\n"
  454.  "<p align=center>\n"
  455.  "Your request for URL\n"
  456.  "<br><b><tt>\n";
  457.  char *tail=
  458.  "\n"
  459.  "</tt></b><br>\n"
  460.  "is not a legal URL on the wwwoffle proxy server.\n"
  461.  "<br>\n"
  462.  "<a href=\"/\">WWWOFFLE Proxy Welcome Page</a>\n"
  463.  "</BODY>\n"
  464.  "</HTML>\n";
  465.  
  466.  write_string(fd,head);
  467.  write_string(fd,pathargs);
  468.  write_string(fd,tail);
  469. }
  470.  
  471.  
  472. /*++++++++++++++++++++++++++++++++++++++
  473.   Print a message that a request was made for a page with a password.
  474.  
  475.   int fd The file descriptor to send the message to.
  476.  
  477.   URL *Url The url that was requested.
  478.   ++++++++++++++++++++++++++++++++++++++*/
  479.  
  480. void PasswordDisallowed(int fd,URL *Url)
  481. {
  482.  char *head=
  483.  "HTTP/1.0 404 WWWOFFLE Password Disallowed\r\n"
  484.  "Content-type: text/html\r\n"
  485.  "\r\n"
  486.  "<HTML>\n"
  487.  "<HEAD>\n"
  488.  "<TITLE>WWWOFFLE - Password Disallowed</TITLE>\n"
  489.  "</HEAD>\n"
  490.  "<BODY>\n"
  491.  "<H1 align=center>WWWOFFLE Password Disallowed</H1>\n"
  492.  "<p align=center>\n"
  493.  "Your request for URL\n"
  494.  "<br><b><tt>\n";
  495.  char *tail=
  496.  "\n"
  497.  "</tt></b><br>\n"
  498.  "included a username (and password), the wwwoffle proxy server does not allow this.\n"
  499.  "<br>\n"
  500.  "<a href=\"/\">WWWOFFLE Proxy Welcome Page</a>\n"
  501.  "</BODY>\n"
  502.  "</HTML>\n";
  503.  
  504.  write_string(fd,head);
  505.  write_string(fd,Url->name);
  506.  write_string(fd,tail);
  507. }
  508.  
  509.  
  510. /*++++++++++++++++++++++++++++++++++++++
  511.   Print a message that an illegal protocol has been requested on the proxy server.
  512.  
  513.   int fd The file descriptor to send the message to.
  514.  
  515.   char *url The URL that was requested.
  516.  
  517.   char *proto The protocol that was specified.
  518.   ++++++++++++++++++++++++++++++++++++++*/
  519.  
  520. void IllegalProto(int fd,char *url,char *proto)
  521. {
  522.  char *head=
  523.  "HTTP/1.0 404 WWWOFFLE Illegal Protocol\r\n"
  524.  "Content-type: text/html\r\n"
  525.  "\r\n"
  526.  "<HTML>\n"
  527.  "<HEAD>\n"
  528.  "<TITLE>WWWOFFLE - Illegal Protocol</TITLE>\n"
  529.  "</HEAD>\n"
  530.  "<BODY>\n"
  531.  "<H1 align=center>WWWOFFLE Illegal Page</H1>\n"
  532.  "<p align=center>\n"
  533.  "Your request for URL\n"
  534.  "<br><b><tt>\n";
  535.  char *middle=
  536.  "\n"
  537.  "</tt></b><br>\n"
  538.  "uses the <b><tt>";
  539.  char *tail=
  540.  "</tt></b> protocol which is not supported by the wwwoffle proxy server.\n"
  541.  "</BODY>\n"
  542.  "</HTML>\n";
  543.  
  544.  write_string(fd,head);
  545.  write_string(fd,url);
  546.  write_string(fd,middle);
  547.  write_string(fd,proto);
  548.  write_string(fd,tail);
  549. }
  550.  
  551.  
  552. /*++++++++++++++++++++++++++++++++++++++
  553.   Return a page stating that the requested page has not been modified.
  554.  
  555.   int fd The file descriptor to write to.
  556.   ++++++++++++++++++++++++++++++++++++++*/
  557.  
  558. void NotModified(int fd)
  559. {
  560.  char *page=
  561.  "HTTP/1.0 304 WWWOFFLE Not Modified\r\n"
  562.  "\r\n";
  563.  
  564.  write_string(fd,page);
  565. }
  566.  
  567.  
  568. /*++++++++++++++++++++++++++++++++++++++
  569.   Return a page stating that no requests can be made while offline.
  570.  
  571.   int fd The file descriptor to write to.
  572.  
  573.   URL *Url The URL that was requested.
  574.   ++++++++++++++++++++++++++++++++++++++*/
  575.  
  576. void RefusedRequest(int fd,URL *Url)
  577. {
  578.  char *head=
  579.  "HTTP/1.0 403 WWWOFFLE Refused\r\n"
  580.  "Content-type: text/html\r\n"
  581.  "\r\n"
  582.  "<HTML>\n"
  583.  "<HEAD>\n"
  584.  "<TITLE>WWWOFFLE - Request Refused</TITLE>\n"
  585.  "</HEAD>\n"
  586.  "<BODY>\n"
  587.  "<H1 align=center>WWWOFFLE Request Refused</H1>\n"
  588.  "<p align=center>\n"
  589.  "Your request for URL\n"
  590.  "<br><b><tt>\n";
  591.  char *tail=
  592.  "\n"
  593.  "</tt></b><br>\n"
  594.  "was refused by the wwwoffle proxy.\n"
  595.  "</BODY>\n"
  596.  "</HTML>\n";
  597.  
  598.  write_string(fd,head);
  599.  write_string(fd,Url->name);
  600.  write_string(fd,tail);
  601. }
  602.