http_file: raw mode functional
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Jun 2013 10:47:12 +0000 (12:47 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Jun 2013 10:47:12 +0000 (12:47 +0200)
and schema updated accordingly

etc/config4.xml
src/filter_http_file.cpp
xml/schema/filter_http_file.rnc

index 02899d2..733791e 100644 (file)
         <message>M</message>
       </filter>
       <filter type="http_file">
-      <mimetypes>/etc/mime.types</mimetypes>
-      <area>
-        <documentroot>.</documentroot>
-       <prefix>/etc</prefix>
-      </area>
+        <mimetypes>/etc/mime.types</mimetypes>
+        <area>
+          <documentroot>.</documentroot>
+         <prefix>/etc</prefix>
+        </area>
+        <area>
+          <documentroot>.</documentroot>
+          <prefix>/raw</prefix>
+         <raw>true</raw>
+        </area>
       </filter>
       <filter type="http_rewrite1">
         <replace content-type="text/html" pattern="YAZ" replacement="yaz"/>
index 1038eab..64efa72 100644 (file)
@@ -175,16 +175,14 @@ void yf::HttpFile::Rep::fetch_file(mp::Session &session,
     fclose(f);
 
     Z_GDU *gdu = 0;
+    mp::odr decode(ODR_DECODE);
     if (raw)
     {
-        odr_setbuf(o, (char *) fbuf, sz, 0);
-        int r = z_GDU(o, &gdu, 0, 0);
+        odr_setbuf(decode, (char *) fbuf, sz, 0);
+        int r = z_GDU(decode, &gdu, 0, 0);
         if (!r)
         {
-            Z_GDU *gdu = o.create_HTTP_Response(session, req, 500);
-            package.response() = gdu;
-            fclose(f);
-            return;
+            gdu = o.create_HTTP_Response(session, req, 500);
         }
     }
     else
index 5cf6199..8f5dd58 100644 (file)
@@ -9,6 +9,7 @@ filter_http_file =
   element mp:mimetypes { xsd:string },
   element mp:area {
     element mp:documentroot { xsd:string },
-    element mp:prefix { xsd:string }
+    element mp:prefix { xsd:string },
+    element mp:raw { xsd:boolean }?
   }*