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 110 by Douglas Thrift, 2004-03-15T21:58:29-08:00 vs.
Revision 114 by Douglas Thrift, 2004-03-16T14:33:08-08:00

# Line 5 | Line 5
5   // $Id$
6  
7   #include "Bender.hpp"
8 + #include "Matcher.hpp"
9 +
10 + #include <xalanc/Include/PlatformDefinitions.hpp>
11 + #include <xercesc/util/PlatformUtils.hpp>
12 + #include <xalanc/XalanTransformer/XalanTransformer.hpp>
13 +
14 + XALAN_USING_XERCES(XMLPlatformUtils)
15 + XALAN_USING_XALAN(XalanTransformer)
16  
17   int main(int argc, char* argv[])
18   {
# Line 22 | Line 30 | int main(int argc, char* argv[])
30  
31   Bender::Bender()
32   {
33 +        string path = sgetenv("PATH_TRANSLATED");
34 +        ifstream file(path.c_str());
35 +
36 +        if (path != "" && file.is_open())
37 +        {
38 +                string line;
39 +                
40 +                do
41 +                {
42 +                        getline(file, line);
43 +
44 +                        buffer << line << "\n";
45 +                }
46 +                while (file.good());
47 +                
48 +                bend(sgetenv("HTTP_USER_AGENT"));
49 +        }
50 +        else
51 +        {
52 +                cout << "Status: 404\n"
53 +                        << "Content-Type: text/html; charset=ISO-8859-1\n\n"
54 +                        << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
55 +                        << "<html><head>\n"
56 +                        << "<title>404 Not Found</title>\n"
57 +                        << "</head><body>\n"
58 +                        << "<h1>Not Found</h1>\n"
59 +                        << "<p>The requested URL " << sgetenv("PATH_INFO") << " was not fo"
60 +                        << "und on this server.</p>\n"
61 +                        << "<hr />\n"
62 +                        << sgetenv("SERVER_SIGNATURE")
63 +                        << "</body></html>\n";
64 +        }
65 + }
66 +
67 + void Bender::bend(const string& agent)
68 + {
69 +        Matcher matcher;
70 +
71 +        if (agent == matcher("/Opera |\\/(\\d+)\\.(\\d+)/"))
72 +        {
73 +                bend();
74 +        }
75 +        else if (agent == matcher(
76 +                "/^Mozilla/4.0 \\(compatible; MSIE (\\d+)\\.(\\d+)(\\w+)?; .*\\)$/"))
77 +        {
78 +                //
79 +        }
80 +        else if (agent == matcher(
81 +                "/^Mozilla/5.0 \\(.*; rv:(\\d+)\\.(\\d+)(\\.d+)?(\\w+)?\\) Gecko\\/.*/"
82 +                ))
83 +        {
84 +                //
85 +        }
86 +        else
87 +        {
88 +                bend();
89 +        }
90 + }
91 +
92 + void Bender::bend(void)
93 + {
94          //
95   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines