ROOT  6.06/09 Reference Guide
TS3WebFile.cxx File Reference
#include "TS3WebFile.h"
#include "TROOT.h"
#include "TError.h"
#include "TSystem.h"
#include "TPRegexp.h"
#include "TEnv.h"
Include dependency graph for TS3WebFile.cxx:

Go to the source code of this file.

## Functions

ClassImp (TS3WebFile) TS3WebFile
Construct a TS3WebFile object. More...

## Function Documentation

 ClassImp ( TS3WebFile )

Construct a TS3WebFile object.

The path argument is a URL of one of the following forms:

    s3://host.example.com/bucket/path/to/my/file
s3http://host.example.com/bucket/path/to/my/file


s3https://host.example.com/bucket/path/to/my/file as3://host.example.com/bucket/path/to/my/file

For files hosted by Google Storage, use the following forms:

   gs://storage.googleapis.com/bucket/path/to/my/file


The 'as3' scheme is accepted for backwards compatibility but its usage is deprecated.

The recommended way to create an instance of this class is through TFile::Open, for instance:

TFile* f1 = TFile::Open("s3://host.example.com/bucket/path/to/my/file") TFile* f2 = TFile::Open("gs://storage.googleapis.com/bucket/path/to/my/file")

The specified scheme (i.e. s3, s3http, s3https, ...) determines the underlying transport protocol to use for downloading the file contents, namely HTTP or HTTPS. The 's3', 's3https', 'gs' and 'gshttps' schemes imply using HTTPS as the transport protocol. The 's3http', 'as3' and 'gshttp' schemes imply using HTTP as the transport protocol.

The 'options' argument can contain 'NOPROXY' if you want to bypass the HTTP proxy when retrieving this file's contents. As for any TWebFile-derived object, the URL of the web proxy can be specified by setting an environmental variable 'http_proxy'. If this variable is set, we ask that proxy to route our requests HTTP(S) requests to the file server.

In addition, you can also use the 'options' argument to provide the access key and secret key to be used for authentication purposes for this file by using a string of the form "AUTH=myAccessKey:mySecretkey". This may be useful to open several files hosted by different providers in the same program/macro, where the environemntal variables solution is not convenient (see below).

If you need to specify both NOPROXY and AUTH separate them by ' ' (blank), for instance: "NOPROXY AUTH=F38XYZABCDeFgH4D0E1F:V+frt4re7J1euSNFnmaf8wwmI4AAAE7kzxZ/TTM+"

Examples: TFile* f1 = TFile::Open("s3://host.example.com/bucket/path/to/my/file", "NOPROXY AUTH=F38XYZABCDeFgH4D0E1F:V+frt4re7J1euSNFnmaf8wwmI4AAAE7kzxZ/TTM+"); TFile* f2 = TFile::Open("s3://host.example.com/bucket/path/to/my/file", "AUTH=F38XYZABCDeFgH4D0E1F:V+frt4re7J1euSNFnmaf8wwmI4AAAE7kzxZ/TTM+");

If there is no authentication information in the 'options' argument (i.e. not AUTH="....") the values of the environmental variables S3_ACCESS_KEY and S3_SECRET_KEY (if set) are expected to contain the access key id and the secret access key, respectively. You have been provided with these credentials by your S3 service provider.

If neither the AUTH information is provided in the 'options' argument nor the environmental variables are set, we try to open the file without providing any authentication information to the server. This is useful when the file is set an access control that allows for any unidentified user to read the file.

Definition at line 64 of file TS3WebFile.cxx.