diff options
Diffstat (limited to 'src/httpget.h')
| -rw-r--r-- | src/httpget.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/httpget.h b/src/httpget.h new file mode 100644 index 0000000..25f5ab1 --- /dev/null +++ b/src/httpget.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | #ifndef BU_HTTP_GET_H | ||
| 2 | #define BU_HTTP_GET_H | ||
| 3 | |||
| 4 | #include "bu/stream.h" | ||
| 5 | #include "bu/fstring.h" | ||
| 6 | #include "bu/url.h" | ||
| 7 | #include "bu/socket.h" | ||
| 8 | |||
| 9 | namespace Bu | ||
| 10 | { | ||
| 11 | class HttpGet : public Bu::Stream | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | HttpGet( const Bu::Url &uSrc, const Bu::FString &sMethod="GET" ); | ||
| 15 | virtual ~HttpGet(); | ||
| 16 | |||
| 17 | void get(); | ||
| 18 | |||
| 19 | // From Bu::Stream | ||
| 20 | virtual void close(); | ||
| 21 | virtual size_t read( void *pBuf, size_t nBytes ); | ||
| 22 | virtual size_t write( const void *pBuf, size_t nBytes ); | ||
| 23 | using Stream::write; | ||
| 24 | |||
| 25 | virtual long tell(); | ||
| 26 | virtual void seek( long offset ); | ||
| 27 | virtual void setPos( long pos ); | ||
| 28 | virtual void setPosEnd( long pos ); | ||
| 29 | virtual bool isEOS(); | ||
| 30 | virtual bool isOpen(); | ||
| 31 | |||
| 32 | virtual void flush(); | ||
| 33 | |||
| 34 | virtual bool canRead(); | ||
| 35 | virtual bool canWrite(); | ||
| 36 | |||
| 37 | virtual bool isReadable(); | ||
| 38 | virtual bool isWritable(); | ||
| 39 | virtual bool isSeekable(); | ||
| 40 | |||
| 41 | virtual bool isBlocking(); | ||
| 42 | virtual void setBlocking( bool bBlocking=true ); | ||
| 43 | |||
| 44 | private: | ||
| 45 | Bu::Url uSrc; | ||
| 46 | Bu::FString sMethod; | ||
| 47 | Bu::Socket sSrv; | ||
| 48 | typedef Bu::Hash<Bu::FString,Bu::FString> MimeHash; | ||
| 49 | MimeHash hMimeIn; | ||
| 50 | MimeHash hMimeOut; | ||
| 51 | }; | ||
| 52 | }; | ||
| 53 | |||
| 54 | #endif | ||
