00001 #ifndef __IHTTP_H
00002 #define __IHTTP_H
00003
00004 #include "INet.h"
00005
00006 #define GET_TYPE_NORMAL 1
00007 #define GET_TYPE_FILE_HOST 2
00008
00009 class IHttp
00010 {
00011 char *Proxy;
00012 int ProxyPort;
00013
00014 int BufferLen;
00015 char *Buffer;
00016
00017 GSocket *Socket;
00018 int ResumeFrom;
00019 char *FileLocation;
00020 char *Headers;
00021 bool NoCache;
00022 char *AuthUser;
00023 char *AuthPassword;
00024
00025 public:
00026 Progress *Meter;
00027
00028 IHttp();
00029 virtual ~IHttp();
00030
00031 void SetResume(int i) { ResumeFrom = i; }
00032 void SetProxy(char *p, int Port);
00033 void SetNoCache(bool i) { NoCache = i; }
00034 void SetAuth(char *User = 0, char *Pass = 0);
00035
00036
00037 GSocket *Handle() { return Socket; }
00038 char *AlternateLocation() { return FileLocation; }
00039 char *GetHeaders() { return Headers; }
00040
00041
00042 bool Open(GSocket *S, char *RemoteHost, int Port = 0);
00043 bool Close();
00044 bool IsOpen();
00045
00046
00047 bool GetFile( GView *Parent,
00048 char *File,
00049 GStream &Out,
00050 int Format = GET_TYPE_NORMAL,
00051 int *ProtocolStatus = 0,
00052 int *Length = 0);
00053
00054
00055 bool Get( GView *Parent,
00056 char *Uri,
00057 int *ProtocolStatus,
00058 GStream *Out,
00059 GStream *OutHeaders = 0);
00060 bool Post( GView *Parent,
00061 char *Uri,
00062 char *ContentType,
00063 GStream *In,
00064 int *ProtocolStatus,
00065 GStream *Out,
00066 GStream *OutHeaders = 0);
00067 };
00068
00069 #endif