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 119 by Douglas Thrift, 2004-03-17T21:15:24-08:00 vs.
Revision 123 by Douglas Thrift, 2004-03-20T18:32:11-08:00

# Line 42 | Line 42 | Bender::Bender()
42                          file.close();
43  
44                          bend(path, sgetenv("HTTP_USER_AGENT"));
45 <
46 <                        return;
45 >                }
46 >                else
47 >                {
48 >                        cout << "Status: 404\n"
49 >                                << "Content-Type: text/html; charset=ISO-8859-1\n\n"
50 >                                << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
51 >                                << "<html><head>\n"
52 >                                << "<title>404 Not Found</title>\n"
53 >                                << "</head><body>\n"
54 >                                << "<h1>Not Found</h1>\n"
55 >                                << "<p>The requested URL " << sgetenv("PATH_INFO") << " was no"
56 >                                << "t found on this server.</p>\n"
57 >                                << "<hr />\n"
58 >                                << sgetenv("SERVER_SIGNATURE")
59 >                                << "</body></html>\n";
60                  }
61          }
62 <
63 <        cout << "Status: 404\n"
64 <                << "Content-Type: text/html; charset=ISO-8859-1\n\n"
65 <                << "<!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 >        else
63 >        {
64 >                cout << "Location: http://computers.douglasthrift.net/bender.xml\n\n";
65 >        }
66   }
67  
68   void Bender::bend(const string& path, const string& agent)
# Line 69 | Line 73 | void Bender::bend(const string& path, co
73          {
74                  bend(path);
75          }
72        else if (agent == matcher(string("^Mozilla/4.0 \\(compatible; MSIE (\\d+)")
73                + "\\.(\\d+)(\\w+)?; .*\\)$"))
74        {
75                int version;
76                istringstream number(matcher[1]);
77
78                number >> version;
79
80                if (version >= 6)
81                {
82                        pass(path);
83                }
84                else
85                {
86                        bend(path);
87                }
88        }
76          else if (agent == matcher(string("^Mozilla/5.0 \\(.*; rv:(\\d+)\\.(\\d+)(")
77                  + "\\.d+)?(\\w+)?\\) Gecko\\/.*"))
78          {
# Line 118 | Line 105 | void Bender::bend(const string& path)
105          if (transformer.transform(path.c_str(), output) == 0)
106          {
107                  string type = "text/html; charset=ISO-8859-1";
108 <                Matcher matcher("<META http-equiv=\"Content-Type\" content=\"(.*)\">");
108 >                Matcher matcher("http-equiv=\"Content-Type\" content=\"(.*)\"");
109  
110                  if (matcher == output.str())
111                  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines