summaryrefslogtreecommitdiff
path: root/src/httpget.h
blob: afa1ec5e9450be9e7835f72bab28728206bb9ec4 (plain)
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
#ifndef HTTP_GET_H
#define HTTP_GET_H

#include <stdint.h>
#include <string>
#include <list>
#include <utility>

#include "sbuffer.h"

class HttpGet
{
public:
	HttpGet();
	HttpGet( const std::string &url );
	virtual ~HttpGet();

	void setURL( const std::string &url );
	void addParam( const std::string &key, const std::string &value );
	void setUserAgent( const std::string &sUserAgent )
	{
		this->sUserAgent = sUserAgent;
	}
	void setHost( const std::string &sHost )
	{
		this->sHost = sHost;
	}

	std::string escape( const std::string &src );
	SBuffer *get();

private:
	std::string sProto;
	std::string sHost;
	std::string sPath;
	std::string sUserAgent;
	typedef std::pair<std::string,std::string> StringPair;
	std::list<StringPair> lParams;
	int nPort;
	static char hexcode[];

};

#endif