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 898 by douglas, 2007-04-28T21:18:18-07:00 vs.
Revision 914 by douglas, 2007-05-05T15:01:03-07:00

# Line 53 | Line 53 | Bender::Bender()
53          cse::String path(env.get(_B("PATH_TRANSLATED")));
54          api::Pcre::RegEx script(_S<ios::String>() << _B("^") << env.get(_B("SCRIPT_NAME")));
55  
56 <        if (!path.IsEmpty() && script(env.get(_B("REQUEST_URI"))))
56 >        if (!path.IsEmpty() && !script(env.get(_B("REQUEST_URI"))))
57          {
58                  try
59                  {
# Line 112 | Line 112 | void Bender::bend(const cse::String& pat
112          args.InsertLast(path);
113  
114          _S<api::Process> xslt(program, args);
115 +        ext::Buffer line;
116 +        api::Pcre::RegEx content("http-equiv=\"Content-Type\" content=\"(.*)\"");
117          _S<ios::String> output;
118 +        cse::String type(_B("text/xml"));
119  
120 <        ios::ReadToWrite(*xslt.GetReader(), output);
118 <
119 <        if (!output.IsEmpty())
120 >        while (ios::ReadLine(*xslt.GetReader(), line))
121          {
122 <                cse::String type(_B("text/xml"));
122 <                api::Pcre::RegEx content("http-equiv=\"Content-Type\" content=\"(.*)\"");
122 >                output << line << ios::NewLine;
123  
124                  if (api::Pcre::RegEx::Match match = content(output))
125 +                {
126                          type = match[1];
127  
128 <                api::Cout << "Content-Type: " << type << "\r\n\r\n" << output;
128 >                        break;
129 >                }
130          }
131 +
132 +        ios::ReadToWrite(*xslt.GetReader(), output);
133 +
134 +        if (!output.IsEmpty())
135 +                api::Cout << "Content-Type: " << type << "\r\n\r\n" << output;
136          else
137                  pass(path);
138   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines