#ifndef ROOT_TWebFile
#define ROOT_TWebFile
#ifndef ROOT_TFile
#include "TFile.h"
#endif
#ifndef ROOT_TUrl
#include "TUrl.h"
#endif
#ifndef ROOT_TSystem
#include "TSystem.h"
#endif
class TSocket;
class TWebSocket;
class TWebFile : public TFile {
friend class TWebSocket;
friend class TWebSystem;
private:
mutable Long64_t fSize;
TSocket *fSocket;
TUrl fProxy;
Bool_t fHasModRoot;
Bool_t fHTTP11;
Bool_t fNoProxy;
TString fMsgReadBuffer;
TString fMsgReadBuffer10;
TString fMsgReadBuffers;
TString fMsgReadBuffers10;
TString fMsgGetHead;
static TUrl fgProxy;
TWebFile() : fSocket(0) { }
void Init(Bool_t readHeadOnly);
void CheckProxy();
TString BasicAuthentication();
Int_t GetHead();
Int_t GetLine(TSocket *s, char *line, Int_t maxsize);
Int_t GetHunk(TSocket *s, char *hunk, Int_t maxsize);
const char *HttpTerminator(const char *start, const char *peeked, Int_t peeklen);
Int_t GetFromWeb(char *buf, Int_t len, const TString &msg);
Int_t GetFromWeb10(char *buf, Int_t len, const TString &msg);
Bool_t ReadBuffer10(char *buf, Int_t len);
Bool_t ReadBuffers10(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
public:
TWebFile(const char *url, Option_t *opt="");
TWebFile(TUrl url, Option_t *opt="");
virtual ~TWebFile();
Long64_t GetSize() const;
Bool_t IsOpen() const;
Int_t ReOpen(Option_t *mode);
Bool_t ReadBuffer(char *buf, Int_t len);
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
void Seek(Long64_t offset, ERelativeTo pos = kBeg);
static void SetProxy(const char *url);
static const char *GetProxy();
ClassDef(TWebFile,1)
};
class TWebSystem : public TSystem {
private:
void *fDirp;
void *GetDirPtr() const { return fDirp; }
public:
TWebSystem();
virtual ~TWebSystem() { }
Int_t MakeDirectory(const char *name);
void *OpenDirectory(const char *name);
void FreeDirectory(void *dirp);
const char *GetDirEntry(void *dirp);
Int_t GetPathInfo(const char *path, FileStat_t &buf);
Bool_t AccessPathName(const char *path, EAccessMode mode);
Int_t Unlink(const char *path);
ClassDef(TWebSystem,0)
};
#endif