6 |
|
|
7 |
|
#include "Environment.hpp" |
8 |
|
#include "Matcher.hpp" |
9 |
+ |
#include "Jargon.hpp" |
10 |
|
|
11 |
|
extern "C" |
12 |
|
{ |
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 |
|
{ |
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 |
|
} |