File indexing completed on 2026-09-18 09:30:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TWebFile
0013 #define ROOT_TWebFile
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "TFile.h"
0026 #include "TUrl.h"
0027 #include "TSystem.h"
0028
0029 class TSocket;
0030
0031 namespace ROOT::Deprecated {
0032
0033 class TWebSocket;
0034 class TWebSystem;
0035
0036 class TWebFile : public TFile {
0037
0038 friend class ROOT::Deprecated::TWebSocket;
0039 friend class ROOT::Deprecated::TWebSystem;
0040
0041 private:
0042 TWebFile() : fSocket(nullptr) {}
0043
0044 protected:
0045 mutable Long64_t fSize;
0046 TSocket *fSocket;
0047 TUrl fProxy;
0048 Bool_t fHasModRoot;
0049 Bool_t fHTTP11;
0050 Bool_t fNoProxy;
0051 TString fMsgReadBuffer;
0052 TString fMsgReadBuffer10;
0053 TString fMsgGetHead;
0054 TString fBasicUrl;
0055 TUrl fUrlOrg;
0056 TString fBasicUrlOrg;
0057 void *fFullCache;
0058 Long64_t fFullCacheSize;
0059
0060 static TUrl fgProxy;
0061 static Long64_t fgMaxFullCacheSize;
0062
0063 void Init(Bool_t readHeadOnly) override;
0064 virtual void CheckProxy();
0065 virtual TString BasicAuthentication();
0066 virtual Int_t GetHead();
0067 virtual Int_t GetLine(TSocket *s, char *line, Int_t maxsize);
0068 virtual Int_t GetHunk(TSocket *s, char *hunk, Int_t maxsize);
0069 virtual const char *HttpTerminator(const char *start, const char *peeked, Int_t peeklen);
0070 virtual Int_t GetFromWeb(char *buf, Int_t len, const TString &msg);
0071 virtual Int_t GetFromWeb10(char *buf, Int_t len, const TString &msg, Int_t nseg = 0, Long64_t *seg_pos = nullptr, Int_t *seg_len = nullptr);
0072 virtual Int_t GetFromCache(char *buf, Int_t len, Int_t nseg, Long64_t *seg_pos, Int_t *seg_len);
0073 virtual Bool_t ReadBuffer10(char *buf, Int_t len);
0074 virtual Bool_t ReadBuffers10(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
0075 virtual void SetMsgReadBuffer10(const char *redirectLocation = nullptr, Bool_t tempRedirect = kFALSE);
0076 virtual void ProcessHttpHeader(const TString& headerLine);
0077
0078 public:
0079 TWebFile(const char *url, Option_t *opt="");
0080 TWebFile(TUrl url, Option_t *opt="");
0081 virtual ~TWebFile();
0082
0083 void Close(Option_t *option="") override;
0084 Long64_t GetSize() const override;
0085 Bool_t IsOpen() const override;
0086 Int_t ReOpen(Option_t *mode) override;
0087 Bool_t ReadBuffer(char *buf, Int_t len) override;
0088 Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len) override;
0089 Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) override;
0090 void Seek(Long64_t offset, ERelativeTo pos = kBeg) override;
0091
0092 static void SetProxy(const char *url);
0093 static const char *GetProxy();
0094
0095 static Long64_t GetMaxFullCacheSize();
0096 static void SetMaxFullCacheSize(Long64_t sz);
0097
0098 ClassDefOverride(TWebFile,2)
0099 };
0100
0101
0102 class TWebSystem : public TSystem {
0103
0104 private:
0105 void *fDirp;
0106
0107 void *GetDirPtr() const override { return fDirp; }
0108
0109 public:
0110 TWebSystem();
0111 virtual ~TWebSystem() {}
0112
0113 Int_t MakeDirectory(const char *name) override;
0114 void *OpenDirectory(const char *name) override;
0115 void FreeDirectory(void *dirp) override;
0116 const char *GetDirEntry(void *dirp) override;
0117 Int_t GetPathInfo(const char *path, FileStat_t &buf) override;
0118 Bool_t AccessPathName(const char *path, EAccessMode mode) override;
0119 Int_t Unlink(const char *path) override;
0120
0121 ClassDefOverride(TWebSystem,0)
0122 };
0123
0124 }
0125
0126 using TWebFile R__DEPRECATED(6, 42, "TWebFile is deprecated") = ROOT::Deprecated::TWebFile;
0127 using TWebSystem R__DEPRECATED(6, 42, "TWebSystem is deprecated") = ROOT::Deprecated::TWebSystem;
0128
0129 #endif