diff options
Diffstat (limited to 'src/experimental/httpget.h')
-rw-r--r-- | src/experimental/httpget.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/experimental/httpget.h b/src/experimental/httpget.h new file mode 100644 index 0000000..a58e8ac --- /dev/null +++ b/src/experimental/httpget.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_HTTP_GET_H | ||
9 | #define BU_HTTP_GET_H | ||
10 | |||
11 | #include "bu/stream.h" | ||
12 | #include "bu/string.h" | ||
13 | #include "bu/url.h" | ||
14 | #include "bu/tcpsocket.h" | ||
15 | #include "bu/hash.h" | ||
16 | |||
17 | namespace Bu | ||
18 | { | ||
19 | class HttpGet : public Bu::Stream | ||
20 | { | ||
21 | public: | ||
22 | HttpGet( const Bu::Url &uSrc, const Bu::String &sMethod="GET" ); | ||
23 | virtual ~HttpGet(); | ||
24 | |||
25 | void get(); | ||
26 | |||
27 | // From Bu::Stream | ||
28 | virtual void close(); | ||
29 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
30 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
31 | using Stream::write; | ||
32 | |||
33 | virtual Bu::size tell(); | ||
34 | virtual void seek( Bu::size offset ); | ||
35 | virtual void setPos( Bu::size pos ); | ||
36 | virtual void setPosEnd( Bu::size pos ); | ||
37 | virtual bool isEos(); | ||
38 | virtual bool isOpen(); | ||
39 | |||
40 | virtual void flush(); | ||
41 | |||
42 | virtual bool canRead(); | ||
43 | virtual bool canWrite(); | ||
44 | |||
45 | virtual bool isReadable(); | ||
46 | virtual bool isWritable(); | ||
47 | virtual bool isSeekable(); | ||
48 | |||
49 | virtual bool isBlocking(); | ||
50 | virtual void setBlocking( bool bBlocking=true ); | ||
51 | |||
52 | virtual size getSize() const; | ||
53 | virtual size getBlockSize() const; | ||
54 | virtual Bu::String getLocation() const; | ||
55 | |||
56 | private: | ||
57 | Bu::Url uSrc; | ||
58 | Bu::String sMethod; | ||
59 | Bu::TcpSocket sSrv; | ||
60 | typedef Bu::Hash<Bu::String,Bu::String> MimeHash; | ||
61 | MimeHash hMimeIn; | ||
62 | MimeHash hMimeOut; | ||
63 | }; | ||
64 | }; | ||
65 | |||
66 | #endif | ||