File: httpbuffer

package info (click to toggle)
crossroads 2.65-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,664 kB
  • ctags: 355
  • sloc: cpp: 4,212; perl: 1,658; xml: 269; makefile: 186; sh: 46
file content (52 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _HTTPBUFFER_
#define _HTTPBUFFER_

#include "sys/sys"
#include "netbuffer/netbuffer"
#include "config/config"
#include "profiler/profiler"

class Httpbuffer: public Netbuffer {
public:

    // Recognized request methods. Modify requestmethod.cc to add more.
    enum RequestMethod {
	m_get,
	m_other,
    };
    
    Httpbuffer();

    bool headersreceived();
    
    string headerval (string const &var);
    string &firstline();
    string url();

    bool setversion(char v);

    void setheader (string const &var, string const &val);
    void setheader (string const &h);

    void addheader (string const &var, string const &val);
    void addheader (string const &h);

    void replaceheader (string const &var, string const &val);
    void replaceheader (string const &h);

    string cookievalue (string var);
    string paramvalue(string var);

    RequestMethod requestmethod();

    string requesturi();

    void reset();

private:    
    unsigned findheader (string h);
    unsigned bodystart;
    string first_line;
};

#endif