crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

httpbuffer (1082B)


      1 #ifndef _HTTPBUFFER_
      2 #define _HTTPBUFFER_
      3 
      4 #include "sys/sys"
      5 #include "netbuffer/netbuffer"
      6 #include "config/config"
      7 #include "profiler/profiler"
      8 
      9 class Httpbuffer: public Netbuffer {
     10 public:
     11 
     12     // Recognized request methods. Modify requestmethod.cc to add more.
     13     enum RequestMethod {
     14 	m_get,
     15 	m_other,
     16     };
     17     
     18     Httpbuffer();
     19 
     20     bool headersreceived();
     21     
     22     string headerval (string const &var);
     23     string &firstline();
     24     string url();
     25 
     26     bool setversion(char v);
     27 
     28     void setheader (string const &var, string const &val);
     29     void setheader (string const &h);
     30 
     31     void addheader (string const &var, string const &val);
     32     void addheader (string const &h);
     33 
     34     void replaceheader (string const &var, string const &val);
     35     void replaceheader (string const &h);
     36 
     37     string cookievalue (string var);
     38     string paramvalue(string var);
     39 
     40     RequestMethod requestmethod();
     41 
     42     string requesturi();
     43 
     44     string as_string() const;
     45     void reset();
     46 
     47 private:    
     48     unsigned findheader (string h);
     49     unsigned bodystart;
     50     string first_line;
     51 };
     52 
     53 #endif