summaryrefslogtreecommitdiffabout
path: root/src/cgi_gateway.cc
Unidiff
Diffstat (limited to 'src/cgi_gateway.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/cgi_gateway.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cgi_gateway.cc b/src/cgi_gateway.cc
index a2681aa..3763654 100644
--- a/src/cgi_gateway.cc
+++ b/src/cgi_gateway.cc
@@ -1,51 +1,52 @@
1#include <errno.h> 1#include <errno.h>
2#include <ctype.h> 2#include <ctype.h>
3#include <sstream> 3#include <sstream>
4#include <cstring>
4#include "kingate/cgi_gateway.h" 5#include "kingate/cgi_gateway.h"
5#include "kingate/util.h" 6#include "kingate/util.h"
6#include "kingate/exception.h" 7#include "kingate/exception.h"
7#include "config.h" 8#include "config.h"
8#ifdef HAVE_MIMETIC 9#ifdef HAVE_MIMETIC
9# include <mimetic/mimeentity.h> 10# include <mimetic/mimeentity.h>
10# include <mimetic/parser/itparser.h> 11# include <mimetic/parser/itparser.h>
11#endif /* HAVE_MIMETIC */ 12#endif /* HAVE_MIMETIC */
12 13
13namespace kingate { 14namespace kingate {
14 15
15#ifdef HAVE_MIMETIC 16#ifdef HAVE_MIMETIC
16 using mimetic::MimeEntity; 17 using mimetic::MimeEntity;
17 18
18 struct TornMimeEntity : public MimeEntity { 19 struct TornMimeEntity : public MimeEntity {
19 typedef istreambuf_iterator<char> it_type; 20 typedef istreambuf_iterator<char> it_type;
20 typedef it_type::iterator_category it_cat; 21 typedef it_type::iterator_category it_cat;
21 struct IParser : public mimetic::IteratorParser<it_type,it_cat> { 22 struct IParser : public mimetic::IteratorParser<it_type,it_cat> {
22 typedef mimetic::IteratorParser<it_type,it_cat> BT; 23 typedef mimetic::IteratorParser<it_type,it_cat> BT;
23 IParser(MimeEntity& me) 24 IParser(MimeEntity& me)
24 : BT::IteratorParser<it_type,it_cat>(me) { } 25 : BT::IteratorParser<it_type,it_cat>(me) { }
25 void loadHeader(it_type bit,it_type eit) { 26 void loadHeader(it_type bit,it_type eit) {
26 m_bit = bit; m_eit = eit; 27 m_bit = bit; m_eit = eit;
27 BT::loadHeader(); 28 BT::loadHeader();
28 } 29 }
29 void loadBody(it_type bit,it_type eit) { 30 void loadBody(it_type bit,it_type eit) {
30 m_bit = bit; m_eit = eit; 31 m_bit = bit; m_eit = eit;
31 BT::loadBody(); 32 BT::loadBody();
32 } 33 }
33 }; 34 };
34 void load(istream& hs,istream& bs,int mask=0) { 35 void load(istream& hs,istream& bs,int mask=0) {
35 IParser prs(*this); 36 IParser prs(*this);
36 prs.iMask(mask); 37 prs.iMask(mask);
37 prs.loadHeader(it_type(hs),it_type()); 38 prs.loadHeader(it_type(hs),it_type());
38 prs.loadBody(it_type(bs),it_type()); 39 prs.loadBody(it_type(bs),it_type());
39 } 40 }
40 }; 41 };
41#endif /* HAVE_MIMETIC */ 42#endif /* HAVE_MIMETIC */
42 43
43 static string empty_string; 44 static string empty_string;
44 45
45 cgi_gateway::basic_file_t::~basic_file_t() { } 46 cgi_gateway::basic_file_t::~basic_file_t() { }
46 47
47 class string_file_t : public cgi_gateway::basic_file_t { 48 class string_file_t : public cgi_gateway::basic_file_t {
48 public: 49 public:
49 string _file_name; 50 string _file_name;
50 string _content_type; 51 string _content_type;
51 stringstream _content; 52 stringstream _content;