00001 #ifndef __IHTTP_H
00002 #define __IHTTP_H
00003
00004 #include "INet.h"
00005
00006 #define GET_TYPE_NORMAL 0x1 // Use basic URI, else file + host format
00007 #define GET_NO_CACHE 0x2
00008
00009 class IHttp
00010 {
00011 char *Proxy;
00012 int ProxyPort;
00013
00014 int BufferLen;
00015 char *Buffer;
00016
00017 GSocketI *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 GSocketI *Handle() { return Socket; }
00038 char *AlternateLocation() { return FileLocation; }
00039 char *GetHeaders() { return Headers; }
00040
00041
00042 bool Open(GSocketI *S, char *RemoteHost, int Port = 0);
00043 bool Close();
00044 bool IsOpen();
00045
00046
00047 bool GetFile( GViewI *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( GViewI *Parent,
00056 char *Uri,
00057 char *InHeaders,
00058 int *ProtocolStatus,
00059 GStream *Out,
00060 GStream *OutHeaders = 0);
00061
00062 bool Post( GViewI *Parent,
00063 char *Uri,
00064 char *ContentType,
00065 GStream *In,
00066 int *ProtocolStatus,
00067 GStream *Out,
00068 GStream *OutHeaders = 0,
00069 char *InHeaders = 0);
00070 };
00071
00072 #endif