#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
