00001
00002
00003
00004
00005
00006 #ifndef __WVHTTP_H
00007 #define __WVHTTP_H
00008
00009 #include "wvurl.h"
00010 #include "wvtcp.h"
00011 #include "wvstreamclone.h"
00012 #include "wvresolver.h"
00013 #include "wvhashtable.h"
00014
00015
00016 struct WvHTTPHeader
00017 {
00018 WvString name, value;
00019
00020 WvHTTPHeader(WvStringParm _name, WvStringParm _value)
00021 : name(_name), value(_value)
00022 {}
00023 };
00024
00025
00026 DeclareWvDict(WvHTTPHeader, WvString, name);
00027
00028 class WvSSLStream;
00029
00034 class WvHTTPStream : public WvStreamClone
00035 {
00036 public:
00037 enum State {Resolving = 0, Connecting, ReadHeader1, ReadHeader, ReadData,
00038 Done};
00039 WvHTTPHeaderDict headers;
00040 WvHTTPHeaderDict client_headers;
00041 size_t num_received;
00042 WvTCPConn *tcp;
00043 WvSSLStream *ssl;
00044 WvStream *conn;
00045
00050 WvHTTPStream(const WvURL &_url);
00051
00052 virtual bool isok() const;
00053 virtual int geterr() const;
00054 virtual WvString errstr() const;
00055 virtual bool pre_select(SelectInfo &si);
00056 virtual size_t uread(void *buf, size_t count);
00057
00058 public:
00059 WvURL url;
00060 State state;
00061
00062 public:
00063 const char *wstype() const { return "WvHTTPStream"; }
00064 };
00065
00066 #endif // __WVHTTP_H