ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/FeepingCreaturism.cpp
(Generate patch)

Comparing FeepingCreaturism/FeepingCreaturism.cpp (file contents):
Revision 194 by Douglas Thrift, 2004-08-27T01:21:18-07:00 vs.
Revision 196 by Douglas Thrift, 2004-08-27T19:31:26-07:00

# Line 6 | Line 6
6  
7   #include "Environment.hpp"
8   #include "Matcher.hpp"
9 + #include "Jargon.hpp"
10  
11   extern "C"
12   {
# Line 54 | Line 55 | void FeepingCreaturism::initialize()
55          ::FTS* traversal(::fts_open(path, FTS_LOGICAL, NULL));
56          Matcher matcher('^' + this->path + "/(" + this->matcher + ")$");
57  
58 +        if (traversal == NULL)
59 +        {
60 +                cerr << "FeepingCreaturism: Horrible Failure!\n";
61 +
62 +                std::exit(1);
63 +        }
64 +
65          for (::FTSENT* entity(::fts_read(traversal)); entity != NULL;
66                  entity = ::fts_read(traversal))
67          {
# Line 98 | Line 106 | void FeepingCreaturism::select(const std
106   {
107          if (!validate || jargon.find(selection) != jargon.end())
108          {
109 <                cout << "Content-Type: text/html; charset=UTF-8\r\n\r\n" << selection
110 <                        << "\r\n";
109 >                cout << "Content-Type: text/html; charset=UTF-8\r\n\r\n";
110 >
111 >                Jargon jargon(path + '/' + selection);
112 >
113 >                cout << jargon;
114 >        }
115 >        else
116 >        {
117 >                cout << "Status: 404\r\nContent-Type: text/html; charset=ISO-8859-1\r\n"
118 >                        << "\r\n<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
119 >                        << "<html><head>\n<title>404 Not Found</title>\n</head><body>\n"
120 >                        << "<h1>Not Found</h1>\n<p>The requested URL "
121 >                        << env.get("PATH_INFO") << " was not found on this server.</p>\n"
122 >                        << "<hr />\n" << env.get("SERVER_SIGNATURE") << "</body></html>\n";
123          }
104        else cout << "Status: 404\r\n\r\n";
124   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines