diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-11-02 08:49:42 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-11-02 08:49:42 +0000 |
commit | 54ef2750aef0c64df56daff50af7719f85017c33 (patch) | |
tree | 698355d5d8522671c66d40164695ed8f9fa4691f /src/httpget.h | |
parent | d1e486136db52b466b788c1d81a5c88b6f24acd9 (diff) | |
download | libbu++-54ef2750aef0c64df56daff50af7719f85017c33.tar.gz libbu++-54ef2750aef0c64df56daff50af7719f85017c33.tar.bz2 libbu++-54ef2750aef0c64df56daff50af7719f85017c33.tar.xz libbu++-54ef2750aef0c64df56daff50af7719f85017c33.zip |
Moved HttpGet in from eubit. It's pretty cool, just give it a url, and it gives
you a Stream contianing the web server's response. Right now it doesn't parse
any headers or anything.
Diffstat (limited to 'src/httpget.h')
-rw-r--r-- | src/httpget.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/httpget.h b/src/httpget.h new file mode 100644 index 0000000..afa1ec5 --- /dev/null +++ b/src/httpget.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef HTTP_GET_H | ||
2 | #define HTTP_GET_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | #include <string> | ||
6 | #include <list> | ||
7 | #include <utility> | ||
8 | |||
9 | #include "sbuffer.h" | ||
10 | |||
11 | class HttpGet | ||
12 | { | ||
13 | public: | ||
14 | HttpGet(); | ||
15 | HttpGet( const std::string &url ); | ||
16 | virtual ~HttpGet(); | ||
17 | |||
18 | void setURL( const std::string &url ); | ||
19 | void addParam( const std::string &key, const std::string &value ); | ||
20 | void setUserAgent( const std::string &sUserAgent ) | ||
21 | { | ||
22 | this->sUserAgent = sUserAgent; | ||
23 | } | ||
24 | void setHost( const std::string &sHost ) | ||
25 | { | ||
26 | this->sHost = sHost; | ||
27 | } | ||
28 | |||
29 | std::string escape( const std::string &src ); | ||
30 | SBuffer *get(); | ||
31 | |||
32 | private: | ||
33 | std::string sProto; | ||
34 | std::string sHost; | ||
35 | std::string sPath; | ||
36 | std::string sUserAgent; | ||
37 | typedef std::pair<std::string,std::string> StringPair; | ||
38 | std::list<StringPair> lParams; | ||
39 | int nPort; | ||
40 | static char hexcode[]; | ||
41 | |||
42 | }; | ||
43 | |||
44 | #endif | ||