CMS 3D CMS Logo

Classes | Functions | Variables
CmsShowSearchFiles.cc File Reference
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <set>
#include "TGClient.h"
#include "TGHtml.h"
#include "TGButton.h"
#include "TGMenu.h"
#include "TGLabel.h"
#include "TGTextEntry.h"
#include "TPluginManager.h"
#include "TUrl.h"
#include "TSocket.h"
#include "TSystem.h"
#include "TVirtualX.h"
#include "TPRegexp.h"
#include "Fireworks/Core/interface/CmsShowSearchFiles.h"
#include "Fireworks/Core/interface/fwLog.h"
#include "Fireworks/Core/interface/fwPaths.h"

Go to the source code of this file.

Classes

class  FWHtml
 

Functions

static std::string readRemote (const char *url)
 
static const std::string s_filePrefix ("file:")
 
static const std::string s_httpPrefix ("http:")
 
static const std::string s_rootPostfix (".root")
 

Variables

static const unsigned int s_columns = 3
 
static const char *const s_prefixes [][s_columns]
 

Function Documentation

static std::string readRemote ( const char *  url)
static

Definition at line 247 of file CmsShowSearchFiles.cc.

References mps_alisetup::msg, alignCSCRings::s, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CmsShowSearchFiles::sendToWebBrowser().

248 {
249  // Read (open) remote files.
250 
251  char *buf = nullptr;
252  TUrl fUrl(url);
253 
254  TString msg = "GET ";
255  msg += fUrl.GetProtocol();
256  msg += "://";
257  msg += fUrl.GetHost();
258  msg += ":";
259  msg += fUrl.GetPort();
260  msg += "/";
261  msg += fUrl.GetFile();
262  msg += "\r\n";
263 
264  TString uri(url);
265  if (!uri.BeginsWith("http://"))
266  return std::string();
267  TSocket s(fUrl.GetHost(), fUrl.GetPort());
268  if (!s.IsValid())
269  return std::string();
270  if (s.SendRaw(msg.Data(), msg.Length()) == -1)
271  return std::string();
272  Int_t size = 1024*1024;
273  buf = (char *)calloc(size, sizeof(char));
274  if (s.RecvRaw(buf, size) == -1) {
275  free(buf);
276  return std::string();
277  }
278  std::string returnValue(buf);
279  free(buf);
280  return returnValue;
281 }
size
Write out results.
static const std::string s_filePrefix ( "file:"  )
static
static const std::string s_httpPrefix ( "http:"  )
static
static const std::string s_rootPostfix ( ".root"  )
static

Variable Documentation

const unsigned int s_columns = 3
static

Definition at line 40 of file CmsShowSearchFiles.cc.

Referenced by CmsShowSearchFiles::showPrefixes().

const char* const s_prefixes[][s_columns]
static
Initial value:
={
{"http://", "Web site known by you",nullptr},
{"file:","Local file [you must type full path name]",nullptr},
{"dcap://","dCache [FNAL]",nullptr},
{"rfio://","Castor [CERN]",nullptr}
}

Definition at line 41 of file CmsShowSearchFiles.cc.

Referenced by CmsShowSearchFiles::showPrefixes().