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

Comparing Bender/Bender.cpp (file contents):
Revision 117 by Douglas Thrift, 2004-03-17T02:02:43-08:00 vs.
Revision 119 by Douglas Thrift, 2004-03-17T21:15:24-08:00

# Line 18 | Line 18 | int main(int argc, char* argv[])
18   {
19          XMLPlatformUtils::Initialize();
20          XalanTransformer::initialize();
21 <        
21 >
22          Bender bender;
23  
24          XalanTransformer::terminate();
# Line 31 | Line 31 | int main(int argc, char* argv[])
31   Bender::Bender()
32   {
33          string path = sgetenv("PATH_TRANSLATED");
34        ifstream file(path.c_str());
34  
35 <        if (path != "" && file.is_open())
36 <        {
38 <                file.close();
39 <                
40 <                bend(path, sgetenv("HTTP_USER_AGENT"));
41 <        }
42 <        else
35 >
36 >        if (path != "")
37          {
38 <                cout << "Status: 404\n"
39 <                        << "Content-Type: text/html; charset=ISO-8859-1\n\n"
40 <                        << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
41 <                        << "<html><head>\n"
42 <                        << "<title>404 Not Found</title>\n"
43 <                        << "</head><body>\n"
44 <                        << "<h1>Not Found</h1>\n"
45 <                        << "<p>The requested URL " << sgetenv("PATH_INFO") << " was not fo"
46 <                        << "und on this server.</p>\n"
47 <                        << "<hr />\n"
54 <                        << sgetenv("SERVER_SIGNATURE")
55 <                        << "</body></html>\n";
38 >                ifstream file(path.c_str());
39 >
40 >                if (file.is_open())
41 >                {
42 >                        file.close();
43 >
44 >                        bend(path, sgetenv("HTTP_USER_AGENT"));
45 >
46 >                        return;
47 >                }
48          }
49 +
50 +        cout << "Status: 404\n"
51 +                << "Content-Type: text/html; charset=ISO-8859-1\n\n"
52 +                << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
53 +                << "<html><head>\n"
54 +                << "<title>404 Not Found</title>\n"
55 +                << "</head><body>\n"
56 +                << "<h1>Not Found</h1>\n"
57 +                << "<p>The requested URL " << sgetenv("PATH_INFO") << " was not found "
58 +                << "on this server.</p>\n"
59 +                << "<hr />\n"
60 +                << sgetenv("SERVER_SIGNATURE")
61 +                << "</body></html>\n";
62   }
63  
64   void Bender::bend(const string& path, const string& agent)
# Line 119 | Line 124 | void Bender::bend(const string& path)
124                  {
125                          type = matcher[1];
126                  }
127 <                
127 >
128                  cout << "Content-Type: " << type << "\n\n" << output.str();
129          }
130          else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines