32 |
|
{ |
33 |
|
string path = sgetenv("PATH_TRANSLATED"); |
34 |
|
|
35 |
< |
|
36 |
< |
if (path != "") |
35 |
> |
if (path != "" && sgetenv("REQUEST_URI").find(sgetenv("SCRIPT_NAME")) != 0) |
36 |
|
{ |
37 |
|
ifstream file(path.c_str()); |
38 |
|
|
72 |
|
{ |
73 |
|
bend(path); |
74 |
|
} |
76 |
– |
else if (agent == matcher(string("^Mozilla/4.0 \\(compatible; MSIE (\\d+)") |
77 |
– |
+ "\\.(\\d+)(\\w+)?; .*\\)$")) |
78 |
– |
{ |
79 |
– |
int version; |
80 |
– |
istringstream number(matcher[1]); |
81 |
– |
|
82 |
– |
number >> version; |
83 |
– |
|
84 |
– |
if (version >= 6) |
85 |
– |
{ |
86 |
– |
pass(path); |
87 |
– |
} |
88 |
– |
else |
89 |
– |
{ |
90 |
– |
bend(path); |
91 |
– |
} |
92 |
– |
} |
75 |
|
else if (agent == matcher(string("^Mozilla/5.0 \\(.*; rv:(\\d+)\\.(\\d+)(") |
76 |
|
+ "\\.d+)?(\\w+)?\\) Gecko\\/.*")) |
77 |
|
{ |
103 |
|
|
104 |
|
if (transformer.transform(path.c_str(), output) == 0) |
105 |
|
{ |
106 |
< |
string type = "text/html; charset=ISO-8859-1"; |
107 |
< |
Matcher matcher("<META http-equiv=\"Content-Type\" content=\"(.*)\">"); |
106 |
> |
string type = "text/xml"; |
107 |
> |
Matcher matcher("http-equiv=\"Content-Type\" content=\"(.*)\""); |
108 |
|
|
109 |
|
if (matcher == output.str()) |
110 |
|
{ |
121 |
|
|
122 |
|
void Bender::pass(const string& path) |
123 |
|
{ |
124 |
< |
cout << "Content-Type: text/xml; charset=ISO-8859-1\n\n"; |
124 |
> |
cout << "Content-Type: text/xml\n\n"; |
125 |
|
|
126 |
|
ifstream fin(path.c_str()); |
127 |
|
string line; |