diff --git a/net/http/inc/TCivetweb.h b/net/http/inc/TCivetweb.h index 048b4e2ebb58d..da26c6877389c 100644 --- a/net/http/inc/TCivetweb.h +++ b/net/http/inc/TCivetweb.h @@ -1,6 +1,14 @@ // $Id$ // Author: Sergey Linev 21/12/2013 +/************************************************************************* + * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + #ifndef ROOT_TCivetweb #define ROOT_TCivetweb @@ -9,10 +17,10 @@ class TCivetweb : public THttpEngine { protected: - void *fCtx; //! civetweb context - void *fCallbacks; //! call-back table for civetweb webserver - TString fTopName; //! name of top item - Bool_t fDebug; //! debug mode + void *fCtx; /// 0; - } + Bool_t IsBinData() const { return fBinData && fBinDataLength > 0; } - TString AccessHeader(TString& buf, const char* name, const char* value = 0, Bool_t doing_set = kFALSE); + TString AccessHeader(TString &buf, const char *name, const char *value = 0, Bool_t doing_set = kFALSE); - TString CountHeader(const TString& buf, Int_t number = -1111) const; + TString CountHeader(const TString &buf, Int_t number = -1111) const; public: - THttpCallArg(); ~THttpCallArg(); // these methods used to set http request arguments - void SetMethod(const char *method) - { - // set request method kind like GET or POST - - fMethod = method; - } + /** set request method kind like GET or POST */ + void SetMethod(const char *method) { fMethod = method; } - void SetTopName(const char *topname) - { - // set engine-specific top-name - - fTopName = topname; - } + /** set engine-specific top-name */ + void SetTopName(const char *topname) { fTopName = topname; } void SetPathAndFileName(const char *fullpath); - void SetPathName(const char *p) - { - // set request path name + /** set request path name */ + void SetPathName(const char *p) { fPathName = p; } - fPathName = p; - } + /** set request file name */ + void SetFileName(const char *f) { fFileName = f; } - void SetFileName(const char *f) - { - // set request file name + /** set name of authenticated user */ + void SetUserName(const char *n) { fUserName = n; } - fFileName = f; - } - - void SetUserName(const char *n) - { - // set name of authenticated user - - fUserName = n; - } - - void SetQuery(const char *q) - { - // set request query - - fQuery = q; - } + /** set request query */ + void SetQuery(const char *q) { fQuery = q; } void SetPostData(void *data, Long_t length); - void SetWSHandle(TNamed* handle); - - TNamed* TakeWSHandle(); - - void SetWSId(void* id) - { - // set web-socket id - - fWSId = id; - } - - void* GetWSId() const - { - // get web-socket id - - return fWSId; - } - + void SetWSHandle(TNamed *handle); - void SetRequestHeader(const char* h) - { - // set full set of request header + TNamed *TakeWSHandle(); - fRequestHeader = h ? h : ""; - } + /** set web-socket id */ + void SetWSId(UInt_t id) { fWSId = id; } - Int_t NumRequestHeader() const - { - // returns number of fields in request header + /** get web-socket id */ + UInt_t GetWSId() const { return fWSId; } - return CountHeader(fRequestHeader).Atoi(); - } + /** set full set of request header */ + void SetRequestHeader(const char *h) { fRequestHeader = h ? h : ""; } - TString GetRequestHeaderName(Int_t number) const - { - // returns field name in request header + /** returns number of fields in request header */ + Int_t NumRequestHeader() const { return CountHeader(fRequestHeader).Atoi(); } - return CountHeader(fRequestHeader, number); - } - - TString GetRequestHeader(const char* name) - { - // get named field from request header - - return AccessHeader(fRequestHeader, name); - } - - const char *GetTopName() const - { - // returns engine-specific top-name - - return fTopName.Data(); - } - - const char *GetMethod() const - { - // returns request method like GET or POST - - return fMethod.Data(); - } - - Bool_t IsPostMethod() const - { - // returns kTRUE if post method is used - - return fMethod.CompareTo("POST")==0; - } - - void* GetPostData() const - { - // return pointer on posted with request data - - return fPostData; - } + /** returns field name in request header */ + TString GetRequestHeaderName(Int_t number) const { return CountHeader(fRequestHeader, number); } - Long_t GetPostDataLength() const - { - // return length of posted with request data + /** get named field from request header */ + TString GetRequestHeader(const char *name) { return AccessHeader(fRequestHeader, name); } - return fPostDataLength; - } + /** returns engine-specific top-name */ + const char *GetTopName() const { return fTopName.Data(); } - const char *GetPathName() const - { - // returns path name from request URL + /** returns request method like GET or POST */ + const char *GetMethod() const { return fMethod.Data(); } - return fPathName.Data(); - } + /** returns kTRUE if post method is used */ + Bool_t IsPostMethod() const { return fMethod.CompareTo("POST") == 0; } - const char *GetFileName() const - { - // returns file name from request URL + /** return pointer on posted with request data */ + void *GetPostData() const { return fPostData; } - return fFileName.Data(); - } + /** return length of posted with request data */ + Long_t GetPostDataLength() const { return fPostDataLength; } - const char *GetUserName() const - { - // return authenticated user name (0 - when no authentication) + /** returns path name from request URL */ + const char *GetPathName() const { return fPathName.Data(); } - return fUserName.Length() > 0 ? fUserName.Data() : 0; - } + /** returns file name from request URL */ + const char *GetFileName() const { return fFileName.Data(); } - const char *GetQuery() const - { - // returns request query (string after ? in request URL) + /** return authenticated user name (0 - when no authentication) */ + const char *GetUserName() const { return fUserName.Length() > 0 ? fUserName.Data() : 0; } - return fQuery.Data(); - } + /** returns request query (string after ? in request URL) */ + const char *GetQuery() const { return fQuery.Data(); } // these methods used in THttpServer to set results of request processing - void SetContentType(const char *typ) - { - // set content type like "text/xml" or "application/json" + /** set content type like "text/xml" or "application/json" */ + void SetContentType(const char *typ) { fContentType = typ; } - fContentType = typ; - } - - void Set404() - { - // mark reply as 404 error - page/request not exists - - SetContentType("_404_"); - } + /** mark reply as 404 error - page/request not exists or refused */ + void Set404() { SetContentType("_404_"); } + /** indicate that http request should response with file content */ void SetFile(const char *filename = 0) { - // indicate that http request should response with file content - SetContentType("_file_"); if (filename != 0) fContent = filename; } - void SetXml() - { - // set content type as JSON - - SetContentType("text/xml"); - } - - void SetJson() - { - // set content type as JSON + /** set content type as XML */ + void SetXml() { SetContentType("text/xml"); } - SetContentType("application/json"); - } + /** set content type as JSON */ + void SetJson() { SetContentType("application/json"); } void AddHeader(const char *name, const char *value); - Int_t NumHeader() const - { - // returns number of fields in header - - return CountHeader(fHeader).Atoi(); - } - - TString GetHeaderName(Int_t number) const - { - // returns field name in header - - return CountHeader(fHeader, number); - } - - TString GetHeader(const char* name); + /** returns number of fields in header */ + Int_t NumHeader() const { return CountHeader(fHeader).Atoi(); } - void SetEncoding(const char *typ) - { - // Set Content-Encoding header like gzip + /** returns field name in header */ + TString GetHeaderName(Int_t number) const { return CountHeader(fHeader, number); } - AccessHeader(fHeader, "Content-Encoding", typ, kTRUE); - } + TString GetHeader(const char *name); - void SetContent(const char *c) - { - // Set content directly + /** Set Content-Encoding header like gzip */ + void SetEncoding(const char *typ) { AccessHeader(fHeader, "Content-Encoding", typ, kTRUE); } - fContent = c; - } + /** Set content directly */ + void SetContent(const char *c) { fContent = c; } Bool_t CompressWithGzip(); - void SetZipping(Int_t kind) - { - // Set kind of content zipping - // 0 - none - // 1 - only when supported in request header - // 2 - if supported and content size bigger than 10K - // 3 - always + /** Set kind of content zipping + * 0 - none + * 1 - only when supported in request header + * 2 - if supported and content size bigger than 10K + * 3 - always */ + void SetZipping(Int_t kind) { fZipping = kind; } - fZipping = kind; - } + /** return kind of content zipping */ + Int_t GetZipping() const { return fZipping; } - Int_t GetZipping() const - { - // return kind of content zipping - - return fZipping; - } - - void SetExtraHeader(const char *name, const char *value) - { - AddHeader(name, value); - } + /** add extra http header value to the reply */ + void SetExtraHeader(const char *name, const char *value) { AddHeader(name, value); } // Fill http header void FillHttpHeader(TString &buf, const char *header = 0); // these methods used to return results of http request processing - Bool_t IsContentType(const char *typ) const - { - return fContentType == typ; - } - - Bool_t Is404() const - { - return IsContentType("_404_"); - } - - Bool_t IsFile() const - { - return IsContentType("_file_"); - } - - const char *GetContentType() const - { - return fContentType.Data(); - } + Bool_t IsContentType(const char *typ) const { return fContentType == typ; } + Bool_t Is404() const { return IsContentType("_404_"); } + Bool_t IsFile() const { return IsContentType("_file_"); } + const char *GetContentType() const { return fContentType.Data(); } void SetBinData(void *data, Long_t length); - Long_t GetContentLength() const - { - return IsBinData() ? fBinDataLength : fContent.Length(); - } + Long_t GetContentLength() const { return IsBinData() ? fBinDataLength : fContent.Length(); } - const void *GetContent() const - { - return IsBinData() ? fBinData : fContent.Data(); - } + const void *GetContent() const { return IsBinData() ? fBinData : fContent.Data(); } ClassDef(THttpCallArg, 0) // Arguments for single HTTP call }; diff --git a/net/http/inc/THttpEngine.h b/net/http/inc/THttpEngine.h index 7cb465ab3a316..3f5ea18755d26 100644 --- a/net/http/inc/THttpEngine.h +++ b/net/http/inc/THttpEngine.h @@ -1,6 +1,14 @@ // $Id$ // Author: Sergey Linev 21/12/2013 +/************************************************************************* + * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + #ifndef ROOT_THttpEngine #define ROOT_THttpEngine @@ -10,19 +18,15 @@ class THttpServer; class THttpCallArg; class TCanvas; - class THttpEngine : public TNamed { protected: friend class THttpServer; - THttpServer *fServer; //! object server + THttpServer *fServer; /// 0; } - TRootSniffer *GetSniffer() const - { - // returns pointer on objects sniffer - - return fSniffer; - } + /** returns pointer on objects sniffer */ + TRootSniffer *GetSniffer() const { return fSniffer; } void SetSniffer(TRootSniffer *sniff); @@ -69,17 +70,11 @@ class THttpServer : public TNamed { void SetReadOnly(Bool_t readonly); - void SetTopName(const char *top) - { - // set name of top item in objects hierarchy - fTopName = top; - } + /** set name of top item in objects hierarchy */ + void SetTopName(const char *top) { fTopName = top; } - const char *GetTopName() const - { - // returns name of top item in objects hierarchy - return fTopName.Data(); - } + /** returns name of top item in objects hierarchy */ + const char *GetTopName() const { return fTopName.Data(); } void SetJSROOT(const char *location); @@ -92,7 +87,7 @@ class THttpServer : public TNamed { void SetTimer(Long_t milliSec = 100, Bool_t mode = kTRUE); /** Check if file is requested, thread safe */ - Bool_t IsFileRequested(const char *uri, TString &res) const; + Bool_t IsFileRequested(const char *uri, TString &res) const; /** Execute HTTP request */ Bool_t ExecuteHttp(THttpCallArg *arg); @@ -107,7 +102,7 @@ class THttpServer : public TNamed { Bool_t Unregister(TObject *obj); /** Restrict access to specified object */ - void Restrict(const char *path, const char* options); + void Restrict(const char *path, const char *options); Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon = 0); diff --git a/net/http/inc/TRootSniffer.h b/net/http/inc/TRootSniffer.h index d38d56ec7f37c..8e0a4bfbd4ea4 100644 --- a/net/http/inc/TRootSniffer.h +++ b/net/http/inc/TRootSniffer.h @@ -1,6 +1,14 @@ // $Id$ // Author: Sergey Linev 22/12/2013 +/************************************************************************* + * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + #ifndef ROOT_TRootSniffer #define ROOT_TRootSniffer @@ -18,51 +26,44 @@ class TRootSniffer; class TRootSnifferScanRec { -friend class TRootSniffer; + friend class TRootSniffer; protected: // different bits used to scan hierarchy enum { - kScan = 0x0001, ///< normal scan of hierarchy - kExpand = 0x0002, ///< expand of specified item - allowed to scan object members - kSearch = 0x0004, ///< search for specified item (only objects and collections) - kCheckChilds = 0x0008, ///< check if there childs, very similar to search - kOnlyFields = 0x0010, ///< if set, only fields for specified item will be set (but all fields) - kActions = 0x001F ///< mask for actions, only actions copied to child rec + kScan = 0x0001, ///< normal scan of hierarchy + kExpand = 0x0002, ///< expand of specified item - allowed to scan object members + kSearch = 0x0004, ///< search for specified item (only objects and collections) + kCheckChilds = 0x0008, ///< check if there childs, very similar to search + kOnlyFields = 0x0010, ///< if set, only fields for specified item will be set (but all fields) + kActions = 0x001F ///< mask for actions, only actions copied to child rec }; + TRootSnifferScanRec *fParent; ///uri); - - TCivetweb *engine = (TCivetweb *) request_info->user_data; + TCivetweb *engine = (TCivetweb *)request_info->user_data; if (engine == 0) return 1; THttpServer *serv = engine->GetServer(); if (serv == 0) return 1; @@ -74,25 +64,21 @@ int websocket_connect_handler(const struct mg_connection *conn, void*) THttpCallArg arg; arg.SetPathAndFileName(request_info->uri); // path and file name arg.SetQuery(request_info->query_string); // query arguments - arg.SetWSId((void *) conn); + arg.SetWSId(TString::Hash((void *)conn, sizeof(void *))); arg.SetMethod("WS_CONNECT"); Bool_t execres = serv->ExecuteHttp(&arg); - // printf("res %d 404 %d\n", execres, arg.Is404()); - return execres && !arg.Is404() ? 0 : 1; } ////////////////////////////////////////////////////////////////////////// -void websocket_ready_handler(struct mg_connection *conn, void*) +void websocket_ready_handler(struct mg_connection *conn, void *) { const struct mg_request_info *request_info = mg_get_request_info(conn); - // printf("Websocket connection established url:%s\n", request_info->uri); - - TCivetweb *engine = (TCivetweb *) request_info->user_data; + TCivetweb *engine = (TCivetweb *)request_info->user_data; if (engine == 0) return; THttpServer *serv = engine->GetServer(); if (serv == 0) return; @@ -102,7 +88,7 @@ void websocket_ready_handler(struct mg_connection *conn, void*) arg.SetQuery(request_info->query_string); // query arguments arg.SetMethod("WS_READY"); - arg.SetWSId((void *) conn); + arg.SetWSId(TString::Hash((void *)conn, sizeof(void *))); arg.SetWSHandle(new TCivetwebWSEngine("websocket", "title", conn)); serv->ExecuteHttp(&arg); @@ -110,11 +96,11 @@ void websocket_ready_handler(struct mg_connection *conn, void*) ////////////////////////////////////////////////////////////////////////// -int websocket_data_handler(struct mg_connection *conn, int, char *data, size_t len, void*) +int websocket_data_handler(struct mg_connection *conn, int, char *data, size_t len, void *) { const struct mg_request_info *request_info = mg_get_request_info(conn); - TCivetweb *engine = (TCivetweb *) request_info->user_data; + TCivetweb *engine = (TCivetweb *)request_info->user_data; if (engine == 0) return 1; THttpServer *serv = engine->GetServer(); if (serv == 0) return 1; @@ -122,38 +108,25 @@ int websocket_data_handler(struct mg_connection *conn, int, char *data, size_t l THttpCallArg arg; arg.SetPathAndFileName(request_info->uri); // path and file name arg.SetQuery(request_info->query_string); // query arguments - arg.SetWSId((void *) conn); + arg.SetWSId(TString::Hash((void *)conn, sizeof(void *))); arg.SetMethod("WS_DATA"); - void* buf = malloc(len+1); // one byte more for null-termination + void *buf = malloc(len + 1); // one byte more for null-termination memcpy(buf, data, len); arg.SetPostData(buf, len); - //if ((bits & 0xF) == 1) - // printf("Get string len %d %s\n", (int) len, (char*) arg.GetPostData()); - //else - // printf("Get data from web socket len bits %d %d\n", bits, (int) len); - serv->ExecuteHttp(&arg); - // static int wscnt = 0; - //if (++wscnt >= 20000) { - // const char* reply = "Send close message"; - // mg_websocket_write(conn, WEBSOCKET_OPCODE_CONNECTION_CLOSE, reply, strlen(reply)); - //} - return 1; } ////////////////////////////////////////////////////////////////////////// -void websocket_close_handler(const struct mg_connection *conn, void*) +void websocket_close_handler(const struct mg_connection *conn, void *) { const struct mg_request_info *request_info = mg_get_request_info(conn); - // printf("Websocket connection closed url:%s\n", request_info->uri); - - TCivetweb *engine = (TCivetweb *) request_info->user_data; + TCivetweb *engine = (TCivetweb *)request_info->user_data; if (engine == 0) return; THttpServer *serv = engine->GetServer(); if (serv == 0) return; @@ -161,38 +134,36 @@ void websocket_close_handler(const struct mg_connection *conn, void*) THttpCallArg arg; arg.SetPathAndFileName(request_info->uri); // path and file name arg.SetQuery(request_info->query_string); // query arguments - arg.SetWSId((void *) conn); + arg.SetWSId(TString::Hash((void *)conn, sizeof(void *))); arg.SetMethod("WS_CLOSE"); serv->ExecuteHttp(&arg); } - ////////////////////////////////////////////////////////////////////////// static int log_message_handler(const struct mg_connection *conn, const char *message) { const struct mg_context *ctx = mg_get_context(conn); - TCivetweb* engine = (TCivetweb*) mg_get_user_data(ctx); + TCivetweb *engine = (TCivetweb *)mg_get_user_data(ctx); if (engine) return engine->ProcessLog(message); // provide debug output - if ((gDebug>0) || (strstr(message,"cannot bind to")!=0)) - fprintf(stderr, "Error in %s\n",message); + if ((gDebug > 0) || (strstr(message, "cannot bind to") != 0)) + fprintf(stderr, "Error in %s\n", message); return 0; } - ////////////////////////////////////////////////////////////////////////// -static int begin_request_handler(struct mg_connection *conn, void*) +static int begin_request_handler(struct mg_connection *conn, void *) { const struct mg_request_info *request_info = mg_get_request_info(conn); - TCivetweb *engine = (TCivetweb *) request_info->user_data; + TCivetweb *engine = (TCivetweb *)request_info->user_data; if (engine == 0) return 0; THttpServer *serv = engine->GetServer(); if (serv == 0) return 0; @@ -223,22 +194,24 @@ static int begin_request_handler(struct mg_connection *conn, void*) arg.SetQuery(request_info->query_string); // query arguments arg.SetTopName(engine->GetTopName()); arg.SetMethod(request_info->request_method); // method like GET or POST - if (request_info->remote_user!=0) - arg.SetUserName(request_info->remote_user); + if (request_info->remote_user != 0) arg.SetUserName(request_info->remote_user); TString header; for (int n = 0; n < request_info->num_headers; n++) - header.Append(TString::Format("%s: %s\r\n", request_info->http_headers[n].name, request_info->http_headers[n].value)); + header.Append( + TString::Format("%s: %s\r\n", request_info->http_headers[n].name, request_info->http_headers[n].value)); arg.SetRequestHeader(header); - const char* len = mg_get_header(conn, "Content-Length"); - Int_t ilen = len!=0 ? TString(len).Atoi() : 0; + const char *len = mg_get_header(conn, "Content-Length"); + Int_t ilen = len != 0 ? TString(len).Atoi() : 0; - if (ilen>0) { - void* buf = malloc(ilen+1); // one byte more for null-termination + if (ilen > 0) { + void *buf = malloc(ilen + 1); // one byte more for null-termination Int_t iread = mg_read(conn, buf, ilen); - if (iread==ilen) arg.SetPostData(buf, ilen); - else free(buf); + if (iread == ilen) + arg.SetPostData(buf, ilen); + else + free(buf); } if (debug) { @@ -254,14 +227,14 @@ static int begin_request_handler(struct mg_connection *conn, void*) cont.Append(TString::Format(" FileName : %s\n", arg.GetFileName())); cont.Append(TString::Format(" Query : %s\n", arg.GetQuery())); cont.Append(TString::Format(" PostData : %ld\n", arg.GetPostDataLength())); - if (arg.GetUserName()) - cont.Append(TString::Format(" User : %s\n", arg.GetUserName())); + if (arg.GetUserName()) cont.Append(TString::Format(" User : %s\n", arg.GetUserName())); cont.Append("

\n"); cont.Append("Environment:
\n

\n");
          for (int n = 0; n < request_info->num_headers; n++)
-            cont.Append(TString::Format("  %s = %s\n", request_info->http_headers[n].name, request_info->http_headers[n].value));
+            cont.Append(
+               TString::Format("  %s = %s\n", request_info->http_headers[n].name, request_info->http_headers[n].value));
          cont.Append("

\n"); arg.SetContentType("text/html"); @@ -278,31 +251,29 @@ static int begin_request_handler(struct mg_connection *conn, void*) arg.FillHttpHeader(hdr, "HTTP/1.1"); mg_printf(conn, "%s", hdr.Data()); } else if (arg.IsFile()) { - mg_send_file(conn, (const char *) arg.GetContent()); + mg_send_file(conn, (const char *)arg.GetContent()); } else { Bool_t dozip = arg.GetZipping() > 0; switch (arg.GetZipping()) { - case 2: - if (arg.GetContentLength() < 10000) { - dozip = kFALSE; - break; - } - case 1: - // check if request header has Accept-Encoding + case 2: + if (arg.GetContentLength() < 10000) { dozip = kFALSE; - for (int n = 0; n < request_info->num_headers; n++) { - TString name = request_info->http_headers[n].name; - if (name.Index("Accept-Encoding", 0, TString::kIgnoreCase) != 0) continue; - TString value = request_info->http_headers[n].value; - dozip = (value.Index("gzip", 0, TString::kIgnoreCase) != kNPOS); - break; - } - break; - case 3: - dozip = kTRUE; + } + case 1: + // check if request header has Accept-Encoding + dozip = kFALSE; + for (int n = 0; n < request_info->num_headers; n++) { + TString name = request_info->http_headers[n].name; + if (name.Index("Accept-Encoding", 0, TString::kIgnoreCase) != 0) continue; + TString value = request_info->http_headers[n].value; + dozip = (value.Index("gzip", 0, TString::kIgnoreCase) != kNPOS); break; + } + + break; + case 3: dozip = kTRUE; break; } if (dozip) arg.CompressWithGzip(); @@ -311,8 +282,7 @@ static int begin_request_handler(struct mg_connection *conn, void*) arg.FillHttpHeader(hdr, "HTTP/1.1"); mg_printf(conn, "%s", hdr.Data()); - if (arg.GetContentLength() > 0) - mg_write(conn, arg.GetContent(), (size_t) arg.GetContentLength()); + if (arg.GetContentLength() > 0) mg_write(conn, arg.GetContent(), (size_t)arg.GetContentLength()); } // Returning non-zero tells civetweb that our function has replied to @@ -320,7 +290,6 @@ static int begin_request_handler(struct mg_connection *conn, void*) return 1; } - ////////////////////////////////////////////////////////////////////////// // // // TCivetweb // @@ -351,18 +320,13 @@ static int begin_request_handler(struct mg_connection *conn, void*) // // ////////////////////////////////////////////////////////////////////////// - ClassImp(TCivetweb) -//////////////////////////////////////////////////////////////////////////////// -/// constructor - -TCivetweb::TCivetweb() : - THttpEngine("civetweb", "compact embedded http server"), - fCtx(0), - fCallbacks(0), - fTopName(), - fDebug(kFALSE) + //////////////////////////////////////////////////////////////////////////////// + /// constructor + + TCivetweb::TCivetweb() + : THttpEngine("civetweb", "compact embedded http server"), fCtx(0), fCallbacks(0), fTopName(), fDebug(kFALSE) { } @@ -371,7 +335,7 @@ TCivetweb::TCivetweb() : TCivetweb::~TCivetweb() { - if (fCtx != 0) mg_stop((struct mg_context *) fCtx); + if (fCtx != 0) mg_stop((struct mg_context *)fCtx); if (fCallbacks != 0) free(fCallbacks); fCtx = 0; fCallbacks = 0; @@ -380,9 +344,9 @@ TCivetweb::~TCivetweb() //////////////////////////////////////////////////////////////////////////////// /// process civetweb log message, can be used to detect critical errors -Int_t TCivetweb::ProcessLog(const char* message) +Int_t TCivetweb::ProcessLog(const char *message) { - if ((gDebug>0) || (strstr(message,"cannot bind to")!=0)) Error("Log", "%s", message); + if ((gDebug > 0) || (strstr(message, "cannot bind to") != 0)) Error("Log", "%s", message); return 0; } @@ -404,7 +368,7 @@ Bool_t TCivetweb::Create(const char *args) fCallbacks = malloc(sizeof(struct mg_callbacks)); memset(fCallbacks, 0, sizeof(struct mg_callbacks)); //((struct mg_callbacks *) fCallbacks)->begin_request = begin_request_handler; - ((struct mg_callbacks *) fCallbacks)->log_message = log_message_handler; + ((struct mg_callbacks *)fCallbacks)->log_message = log_message_handler; TString sport = "8080"; TString num_threads = "5"; TString auth_file, auth_domain, log_file; @@ -414,8 +378,7 @@ Bool_t TCivetweb::Create(const char *args) // first extract port number sport = ""; - while ((*args != 0) && (*args != '?') && (*args != '/')) - sport.Append(*args++); + while ((*args != 0) && (*args != '?') && (*args != '/')) sport.Append(*args++); // than search for extra parameters while ((*args != 0) && (*args != '?')) args++; @@ -443,8 +406,7 @@ Bool_t TCivetweb::Create(const char *args) if (url.HasOption("debug")) fDebug = kTRUE; - if (url.HasOption("loopback") && (sport.Index(":")==kNPOS)) - sport = TString("127.0.0.1:") + sport; + if (url.HasOption("loopback") && (sport.Index(":") == kNPOS)) sport = TString("127.0.0.1:") + sport; } } } @@ -474,20 +436,14 @@ Bool_t TCivetweb::Create(const char *args) options[op++] = 0; // Start the web server. - fCtx = mg_start((struct mg_callbacks *) fCallbacks, this, options); + fCtx = mg_start((struct mg_callbacks *)fCallbacks, this, options); if (fCtx == 0) return kFALSE; - mg_set_request_handler((struct mg_context *) fCtx, "/", begin_request_handler, 0); + mg_set_request_handler((struct mg_context *)fCtx, "/", begin_request_handler, 0); - mg_set_websocket_handler((struct mg_context *) fCtx, - "**root.websocket$", - websocket_connect_handler, - websocket_ready_handler, - websocket_data_handler, - websocket_close_handler, - 0); + mg_set_websocket_handler((struct mg_context *)fCtx, "**root.websocket$", websocket_connect_handler, + websocket_ready_handler, websocket_data_handler, websocket_close_handler, 0); return kTRUE; } - diff --git a/net/http/src/TFastCgi.cxx b/net/http/src/TFastCgi.cxx index 0e5e5b3f685be..36a21913b40ab 100644 --- a/net/http/src/TFastCgi.cxx +++ b/net/http/src/TFastCgi.cxx @@ -1,6 +1,14 @@ // $Id$ // Author: Sergey Linev 28/12/2013 +/************************************************************************* + * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + #include "TFastCgi.h" #include "TThread.h" @@ -37,9 +45,9 @@ void FCGX_ROOT_send_file(FCGX_Request *request, const char *fname) FCGX_FPrintF(request->out, "Status: 200 OK\r\n" "Content-Type: %s\r\n" - "Content-Length: %d\r\n" // Always set Content-Length - "\r\n", THttpServer::GetMimeType(fname), length); - + "Content-Length: %d\r\n" // Always set Content-Length + "\r\n", + THttpServer::GetMimeType(fname), length); FCGX_PutStr(buf, length, request->out); @@ -47,10 +55,8 @@ void FCGX_ROOT_send_file(FCGX_Request *request, const char *fname) } } - #endif - ////////////////////////////////////////////////////////////////////////// // // // TFastCgi // @@ -88,18 +94,13 @@ void FCGX_ROOT_send_file(FCGX_Request *request, const char *fname) // // ////////////////////////////////////////////////////////////////////////// - ClassImp(TFastCgi) -//////////////////////////////////////////////////////////////////////////////// -/// normal constructor - -TFastCgi::TFastCgi() : - THttpEngine("fastcgi", "fastcgi interface to webserver"), - fSocket(0), - fDebugMode(kFALSE), - fTopName(), - fThrd(0) + //////////////////////////////////////////////////////////////////////////////// + /// normal constructor + + TFastCgi::TFastCgi() + : THttpEngine("fastcgi", "fastcgi interface to webserver"), fSocket(0), fDebugMode(kFALSE), fTopName(), fThrd(0) { } @@ -131,16 +132,13 @@ Bool_t TFastCgi::Create(const char *args) #ifndef HTTP_WITHOUT_FASTCGI FCGX_Init(); -// Info("Create", "Analyze url %s", s.Data()); - TString sport = ":9000"; if ((args != 0) && (strlen(args) > 0)) { // first extract port number sport = ":"; - while ((*args != 0) && (*args >= '0') && (*args <= '9')) - sport.Append(*args++); + while ((*args != 0) && (*args >= '0') && (*args <= '9')) sport.Append(*args++); // than search for extra parameters while ((*args != 0) && (*args != '?')) args++; @@ -158,8 +156,6 @@ Bool_t TFastCgi::Create(const char *args) if (top != 0) fTopName = top; } } - -// Info("Create", "valid url opt %s debug = %d", url.GetOptions(), fDebugMode); } Info("Create", "Starting FastCGI server on port %s", sport.Data() + 1); @@ -176,14 +172,13 @@ Bool_t TFastCgi::Create(const char *args) #endif } - //////////////////////////////////////////////////////////////////////////////// void *TFastCgi::run_func(void *args) { #ifndef HTTP_WITHOUT_FASTCGI - TFastCgi *engine = (TFastCgi *) args; + TFastCgi *engine = (TFastCgi *)args; FCGX_Request request; @@ -210,35 +205,38 @@ void *TFastCgi::run_func(void *args) if (inp_method != 0) arg.SetMethod(inp_method); if (engine->fTopName.Length() > 0) arg.SetTopName(engine->fTopName.Data()); int len = 0; - if (inp_length!=0) len = strtol(inp_length, NULL, 10); - if (len>0) { - void* buf = malloc(len+1); // one myte more for null-termination - int nread = FCGX_GetStr((char*) buf, len, request.in); - if (nread>0) arg.SetPostData(buf, nread); - else free(buf); + if (inp_length != 0) len = strtol(inp_length, NULL, 10); + if (len > 0) { + void *buf = malloc(len + 1); // one myte more for null-termination + int nread = FCGX_GetStr((char *)buf, len, request.in); + if (nread > 0) + arg.SetPostData(buf, nread); + else + free(buf); } TString header; for (char **envp = request.envp; *envp != NULL; envp++) { TString entry = *envp; - for (Int_t n=0;n0) && (arg.GetRequestHeader("AUTH_TYPE").Length()>0)) - arg.SetUserName(username); + if ((username.Length() > 0) && (arg.GetRequestHeader("AUTH_TYPE").Length() > 0)) arg.SetUserName(username); if (engine->fDebugMode) { - FCGX_FPrintF(request.out, - "Status: 200 OK\r\n" - "Content-type: text/html\r\n" - "\r\n" - "FastCGI echo" - "

FastCGI echo

\n"); + FCGX_FPrintF(request.out, "Status: 200 OK\r\n" + "Content-type: text/html\r\n" + "\r\n" + "FastCGI echo" + "

FastCGI echo

\n"); FCGX_FPrintF(request.out, "Request %d:
\n
\n", count);
          FCGX_FPrintF(request.out, "  Method   : %s\n", arg.GetMethod());
@@ -266,16 +264,13 @@ void *TFastCgi::run_func(void *args)
          continue;
       }
 
-//      printf("PATHNAME %s FILENAME %s QUERY %s \n",
-//             arg.GetPathName(), arg.GetFileName(), arg.GetQuery());
-
       TString hdr;
 
       if (!engine->GetServer()->ExecuteHttp(&arg) || arg.Is404()) {
          arg.FillHttpHeader(hdr, "Status:");
          FCGX_FPrintF(request.out, hdr.Data());
       } else if (arg.IsFile()) {
-         FCGX_ROOT_send_file(&request, (const char *) arg.GetContent());
+         FCGX_ROOT_send_file(&request, (const char *)arg.GetContent());
       } else {
 
          // TODO: check in request header that gzip encoding is supported
@@ -284,8 +279,7 @@ void *TFastCgi::run_func(void *args)
          arg.FillHttpHeader(hdr, "Status:");
          FCGX_FPrintF(request.out, hdr.Data());
 
-         FCGX_PutStr((const char *) arg.GetContent(),
-                     (int) arg.GetContentLength(), request.out);
+         FCGX_PutStr((const char *)arg.GetContent(), (int)arg.GetContentLength(), request.out);
       }
 
       FCGX_Finish_r(&request);
@@ -298,4 +292,3 @@ void *TFastCgi::run_func(void *args)
    return args;
 #endif
 }
-
diff --git a/net/http/src/THttpCallArg.cxx b/net/http/src/THttpCallArg.cxx
index 9a0efc5a3af33..b7927d2c4b05e 100644
--- a/net/http/src/THttpCallArg.cxx
+++ b/net/http/src/THttpCallArg.cxx
@@ -1,6 +1,14 @@
 // $Id$
 // Author: Sergey Linev   21/05/2015
 
+/*************************************************************************
+ * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
 #include "THttpCallArg.h"
 
 #include 
@@ -18,28 +26,13 @@
 
 ClassImp(THttpCallArg)
 
-////////////////////////////////////////////////////////////////////////////////
-/// constructor
-
-THttpCallArg::THttpCallArg() :
-   TObject(),
-   fTopName(),
-   fMethod(),
-   fPathName(),
-   fFileName(),
-   fUserName(),
-   fQuery(),
-   fPostData(0),
-   fPostDataLength(0),
-   fWSHandle(0),
-   fWSId(0),
-   fContentType(),
-   fRequestHeader(),
-   fHeader(),
-   fContent(),
-   fZipping(0),
-   fBinData(0),
-   fBinDataLength(0)
+   ////////////////////////////////////////////////////////////////////////////////
+   /// constructor
+
+   THttpCallArg::THttpCallArg()
+   : TObject(), fTopName(), fMethod(), fPathName(), fFileName(), fUserName(), fQuery(), fPostData(0),
+     fPostDataLength(0), fWSHandle(0), fWSId(0), fContentType(), fRequestHeader(), fHeader(), fContent(), fZipping(0),
+     fBinData(0), fBinDataLength(0)
 {
 }
 
@@ -71,13 +64,13 @@ THttpCallArg::~THttpCallArg()
 ///   field2 : value2\\r\\n
 /// Such format corresponds to header format in HTTP requests
 
-TString THttpCallArg::AccessHeader(TString& buf, const char* name, const char* value, Bool_t doing_set)
+TString THttpCallArg::AccessHeader(TString &buf, const char *name, const char *value, Bool_t doing_set)
 {
-   if (name==0) return TString();
+   if (name == 0) return TString();
 
    Int_t curr = 0;
 
-   while (curr < buf.Length()-2) {
+   while (curr < buf.Length() - 2) {
 
       Int_t next = buf.Index("\r\n", curr);
       if (next == kNPOS) break; // should never happen
@@ -87,9 +80,9 @@ TString THttpCallArg::AccessHeader(TString& buf, const char* name, const char* v
          continue;
       }
 
-      if ((value==0) && doing_set) {
+      if ((value == 0) && doing_set) {
          // special case - empty value means that field must be removed completely
-         buf.Remove(curr, next-curr+2);
+         buf.Remove(curr, next - curr + 2);
          return TString();
       }
 
@@ -98,13 +91,13 @@ TString THttpCallArg::AccessHeader(TString& buf, const char* name, const char* v
       curr++;
       while ((curr < next) && (buf[curr] == ' ')) curr++;
 
-      if (value==0) return buf(curr, next-curr);
-      buf.Remove(curr, next-curr);
+      if (value == 0) return buf(curr, next - curr);
+      buf.Remove(curr, next - curr);
       buf.Insert(curr, value);
       return TString(value);
    }
 
-   if (value==0) return TString();
+   if (value == 0) return TString();
 
    buf.Append(TString::Format("%s: %s\r\n", name, value));
    return TString(value);
@@ -113,11 +106,11 @@ TString THttpCallArg::AccessHeader(TString& buf, const char* name, const char* v
 ////////////////////////////////////////////////////////////////////////////////
 /// method used to counter number of headers or returns name of specified header
 
-TString THttpCallArg::CountHeader(const TString& buf, Int_t number) const
+TString THttpCallArg::CountHeader(const TString &buf, Int_t number) const
 {
    Int_t curr(0), cnt(0);
 
-   while (curr < buf.Length()-2) {
+   while (curr < buf.Length() - 2) {
 
       Int_t next = buf.Index("\r\n", curr);
       if (next == kNPOS) break; // should never happen
@@ -126,7 +119,7 @@ TString THttpCallArg::CountHeader(const TString& buf, Int_t number) const
          // we should extract name of header
          Int_t separ = curr + 1;
          while ((separ < next) && (buf[separ] != ':')) separ++;
-         return buf(curr, separ-curr);
+         return buf(curr, separ - curr);
       }
 
       curr = next + 2;
@@ -147,7 +140,7 @@ TString THttpCallArg::CountHeader(const TString& buf, Int_t number) const
 void THttpCallArg::SetPostData(void *data, Long_t length)
 {
    if (fPostData) free(fPostData);
-   if (data!=0) *(((char*) data) + length) = 0;
+   if (data != 0) *(((char *)data) + length) = 0;
    fPostData = data;
    fPostDataLength = length;
 }
@@ -155,7 +148,7 @@ void THttpCallArg::SetPostData(void *data, Long_t length)
 ////////////////////////////////////////////////////////////////////////////////
 /// assign websocket handle with HTTP call
 
-void THttpCallArg::SetWSHandle(TNamed* handle)
+void THttpCallArg::SetWSHandle(TNamed *handle)
 {
    if (fWSHandle) delete fWSHandle;
    fWSHandle = handle;
@@ -165,9 +158,9 @@ void THttpCallArg::SetWSHandle(TNamed* handle)
 /// takeout websocket handle with HTTP call
 /// can be done only once
 
-TNamed* THttpCallArg::TakeWSHandle()
+TNamed *THttpCallArg::TakeWSHandle()
 {
-   TNamed* res = fWSHandle;
+   TNamed *res = fWSHandle;
    fWSHandle = 0;
    return res;
 }
@@ -212,12 +205,12 @@ void THttpCallArg::SetPathAndFileName(const char *fullpath)
 ////////////////////////////////////////////////////////////////////////////////
 /// return specified header
 
-TString THttpCallArg::GetHeader(const char* name)
+TString THttpCallArg::GetHeader(const char *name)
 {
    if ((name == 0) || (*name == 0)) return TString();
 
-   if (strcmp(name,"Content-Type") == 0) return fContentType;
-   if (strcmp(name,"Content-Length") == 0) return TString::Format("%ld", GetContentLength());
+   if (strcmp(name, "Content-Type") == 0) return fContentType;
+   if (strcmp(name, "Content-Length") == 0) return TString::Format("%ld", GetContentLength());
 
    return AccessHeader(fHeader, name);
 }
@@ -229,9 +222,9 @@ TString THttpCallArg::GetHeader(const char* name)
 
 void THttpCallArg::AddHeader(const char *name, const char *value)
 {
-   if ((name == 0) || (*name == 0) || (strcmp(name,"Content-Length") == 0)) return;
+   if ((name == 0) || (*name == 0) || (strcmp(name, "Content-Length") == 0)) return;
 
-   if (strcmp(name,"Content-Type") == 0)
+   if (strcmp(name, "Content-Type") == 0)
       SetContentType(value);
    else
       AccessHeader(fHeader, name, value, kTRUE);
@@ -247,17 +240,15 @@ void THttpCallArg::FillHttpHeader(TString &hdr, const char *kind)
    if ((fContentType.Length() == 0) || Is404()) {
       hdr.Form("%s 404 Not Found\r\n"
                "Content-Length: 0\r\n"
-               "Connection: close\r\n\r\n", kind);
+               "Connection: close\r\n\r\n",
+               kind);
    } else {
       hdr.Form("%s 200 OK\r\n"
                "Content-Type: %s\r\n"
                "Connection: keep-alive\r\n"
                "Content-Length: %ld\r\n"
                "%s\r\n",
-               kind,
-               GetContentType(),
-               GetContentLength(),
-               fHeader.Data());
+               kind, GetContentType(), GetContentLength(), fHeader.Data());
    }
 }
 
@@ -266,11 +257,11 @@ void THttpCallArg::FillHttpHeader(TString &hdr, const char *kind)
 
 Bool_t THttpCallArg::CompressWithGzip()
 {
-   char *objbuf = (char *) GetContent();
+   char *objbuf = (char *)GetContent();
    Long_t objlen = GetContentLength();
 
    unsigned long objcrc = R__crc32(0, NULL, 0);
-   objcrc = R__crc32(objcrc, (const unsigned char *) objbuf, objlen);
+   objcrc = R__crc32(objcrc, (const unsigned char *)objbuf, objlen);
 
    // 10 bytes (ZIP header), compressed data, 8 bytes (CRC and original length)
    Int_t buflen = 10 + objlen + 8;
@@ -278,20 +269,20 @@ Bool_t THttpCallArg::CompressWithGzip()
 
    void *buffer = malloc(buflen);
 
-   char *bufcur = (char *) buffer;
+   char *bufcur = (char *)buffer;
 
-   *bufcur++ = 0x1f;  // first byte of ZIP identifier
-   *bufcur++ = 0x8b;  // second byte of ZIP identifier
-   *bufcur++ = 0x08;  // compression method
-   *bufcur++ = 0x00;  // FLAG - empty, no any file names
+   *bufcur++ = 0x1f; // first byte of ZIP identifier
+   *bufcur++ = 0x8b; // second byte of ZIP identifier
+   *bufcur++ = 0x08; // compression method
+   *bufcur++ = 0x00; // FLAG - empty, no any file names
    *bufcur++ = 0;    // empty timestamp
    *bufcur++ = 0;    //
    *bufcur++ = 0;    //
    *bufcur++ = 0;    //
    *bufcur++ = 0;    // XFL (eXtra FLags)
    *bufcur++ = 3;    // OS   3 means Unix
-   //strcpy(bufcur, "item.json");
-   //bufcur += strlen("item.json")+1;
+   // strcpy(bufcur, "item.json");
+   // bufcur += strlen("item.json")+1;
 
    char dummy[8];
    memcpy(dummy, bufcur - 6, 6);
@@ -303,17 +294,19 @@ Bool_t THttpCallArg::CompressWithGzip()
 
    bufcur += (ziplen - 6); // jump over compressed data (6 byte is extra ROOT header)
 
-   *bufcur++ = objcrc & 0xff;    // CRC32
+   // write CRC32
+   *bufcur++ = objcrc & 0xff;
    *bufcur++ = (objcrc >> 8) & 0xff;
    *bufcur++ = (objcrc >> 16) & 0xff;
    *bufcur++ = (objcrc >> 24) & 0xff;
 
-   *bufcur++ = objlen & 0xff;  // original data length
-   *bufcur++ = (objlen >> 8) & 0xff;  // original data length
-   *bufcur++ = (objlen >> 16) & 0xff;  // original data length
-   *bufcur++ = (objlen >> 24) & 0xff;  // original data length
+   // write original data length
+   *bufcur++ = objlen & 0xff;
+   *bufcur++ = (objlen >> 8) & 0xff;
+   *bufcur++ = (objlen >> 16) & 0xff;
+   *bufcur++ = (objlen >> 24) & 0xff;
 
-   SetBinData(buffer, bufcur - (char *) buffer);
+   SetBinData(buffer, bufcur - (char *)buffer);
 
    SetEncoding("gzip");
 
diff --git a/net/http/src/THttpEngine.cxx b/net/http/src/THttpEngine.cxx
index 02e72ea1c51dc..8a5e01482cceb 100644
--- a/net/http/src/THttpEngine.cxx
+++ b/net/http/src/THttpEngine.cxx
@@ -1,6 +1,14 @@
 // $Id$
 // Author: Sergey Linev   21/12/2013
 
+/*************************************************************************
+ * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
 #include "THttpEngine.h"
 
 #include 
@@ -24,12 +32,11 @@
 
 ClassImp(THttpEngine)
 
-////////////////////////////////////////////////////////////////////////////////
-/// normal constructor
+   ////////////////////////////////////////////////////////////////////////////////
+   /// normal constructor
 
-THttpEngine::THttpEngine(const char *name, const char *title) :
-   TNamed(name, title),
-   fServer(0)
+   THttpEngine::THttpEngine(const char *name, const char *title)
+   : TNamed(name, title), fServer(0)
 {
 }
 
@@ -41,18 +48,13 @@ THttpEngine::~THttpEngine()
    fServer = 0;
 }
 
-
 ClassImp(THttpWSEngine)
 
-////////////////////////////////////////////////////////////////////////////////
-/// normal constructor
-
-THttpWSEngine::THttpWSEngine(const char* name, const char* title) :
-   TNamed(name, title),
-   fReady(kFALSE),
-   fModified(kFALSE),
-   fGetMenu(kFALSE),
-   fCanv(0)
+   ////////////////////////////////////////////////////////////////////////////////
+   /// normal constructor
+
+   THttpWSEngine::THttpWSEngine(const char *name, const char *title)
+   : TNamed(name, title), fReady(kFALSE), fModified(kFALSE), fGetMenu(kFALSE), fCanv(0)
 {
 }
 
@@ -83,20 +85,20 @@ void THttpWSEngine::CheckModifiedFlag()
    TString buf;
 
    if (fGetMenu) {
-      TClass* cl = fCanv->IsA();
+      TClass *cl = fCanv->IsA();
 
-      TList* lst = new TList;
+      TList *lst = new TList;
       cl->GetMenuItems(lst);
       // while there is no streamer for TMethod class, one needs own implementation
 
       // TBufferJSON::ConvertToJSON(lst, 3);
 
       TIter iter(lst);
-      TMethod* m = 0;
+      TMethod *m = 0;
       Int_t cnt = 0;
 
       buf = "MENU[";
-      while ((m = (TMethod*) iter()) != 0) {
+      while ((m = (TMethod *)iter()) != 0) {
          if (cnt++ > 0) buf.Append(",");
          buf.Append("{");
          buf.Append(TString::Format("\"name\":\"%s\",\"title\":\"%s\"", m->GetName(), m->GetTitle()));
@@ -105,27 +107,30 @@ void THttpWSEngine::CheckModifiedFlag()
             TString getter;
             if (m->Getter() && strlen(m->Getter()) > 0) {
                getter = m->Getter();
-            } else
-            if (strncmp(m->GetName(),"Set",3)==0) {
-               getter = TString(m->GetName())(3, strlen(m->GetName())-3);
-               if (cl->GetMethodAllAny(TString("Has") + getter)) getter = TString("Has") + getter;
-               else if (cl->GetMethodAllAny(TString("Get") + getter)) getter = TString("Get") + getter;
-               else if (cl->GetMethodAllAny(TString("Is") + getter)) getter = TString("Is") + getter;
-               else getter = "";
+            } else if (strncmp(m->GetName(), "Set", 3) == 0) {
+               getter = TString(m->GetName())(3, strlen(m->GetName()) - 3);
+               if (cl->GetMethodAllAny(TString("Has") + getter))
+                  getter = TString("Has") + getter;
+               else if (cl->GetMethodAllAny(TString("Get") + getter))
+                  getter = TString("Get") + getter;
+               else if (cl->GetMethodAllAny(TString("Is") + getter))
+                  getter = TString("Is") + getter;
+               else
+                  getter = "";
             }
 
-            if ((getter.Length()>0) && cl->GetMethodAllAny(getter)) {
+            if ((getter.Length() > 0) && cl->GetMethodAllAny(getter)) {
 
-               TMethodCall* call = new TMethodCall(cl, getter, "");
+               TMethodCall *call = new TMethodCall(cl, getter, "");
 
                if (call->ReturnType() == TMethodCall::kLong) {
-                 Long_t l(0);
-                 call->Execute(fCanv, l);
-                 buf.Append(TString::Format(",\"chk\":%s", (l!=0) ? "true" : "false"));
-                 buf.Append(TString::Format(",\"exec\":\"%s(%s)\"", m->GetName(), (l!=0) ? "0" : "1"));
-                 // printf("Toggle %s getter %s chk: %s \n", m->GetName(), getter.Data(), (l!=0) ? "true" : "false");
+                  Long_t l(0);
+                  call->Execute(fCanv, l);
+                  buf.Append(TString::Format(",\"chk\":%s", (l != 0) ? "true" : "false"));
+                  buf.Append(TString::Format(",\"exec\":\"%s(%s)\"", m->GetName(), (l != 0) ? "0" : "1"));
+                  // printf("Toggle %s getter %s chk: %s \n", m->GetName(), getter.Data(), (l!=0) ? "true" : "false");
                } else {
-                 printf("Cannot get toggle value with getter %s \n", getter.Data());
+                  printf("Cannot get toggle value with getter %s \n", getter.Data());
                }
             }
          } else {
@@ -134,14 +139,13 @@ void THttpWSEngine::CheckModifiedFlag()
 
          buf.Append("}");
       }
-      buf  += "]";
+      buf += "]";
       delete lst;
 
       fGetMenu = kFALSE;
-   } else
-   if (fModified) {
+   } else if (fModified) {
       buf = "JSON";
-      buf  += TBufferJSON::ConvertToJSON(fCanv, 3);
+      buf += TBufferJSON::ConvertToJSON(fCanv, 3);
       fModified = kFALSE;
    }
 
@@ -151,49 +155,46 @@ void THttpWSEngine::CheckModifiedFlag()
    }
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// process data received from the client
 
-void THttpWSEngine::ProcessData(THttpCallArg* arg)
+void THttpWSEngine::ProcessData(THttpCallArg *arg)
 {
-   if ((arg==0) && (arg->GetPostDataLength()<=0)) return;
+   if ((arg == 0) && (arg->GetPostDataLength() <= 0)) return;
 
-   const char* cdata = (const char*) arg->GetPostData();
+   const char *cdata = (const char *)arg->GetPostData();
 
-   if (strncmp(cdata,"READY",5)==0) {
+   if (strncmp(cdata, "READY", 5) == 0) {
       fReady = kTRUE;
       CheckModifiedFlag();
       return;
    }
 
-   if (strncmp(cdata,"GETMENU",7)==0) {
+   if (strncmp(cdata, "GETMENU", 7) == 0) {
       fGetMenu = kTRUE;
       CheckModifiedFlag();
       return;
    }
 
-   if (strncmp(cdata,"EXEC",4)==0) {
+   if (strncmp(cdata, "EXEC", 4) == 0) {
 
-      if (fCanv!=0) {
+      if (fCanv != 0) {
 
          TString exec;
-         exec.Form("((%s*) %p)->%s;", fCanv->ClassName(), fCanv, cdata+4);
-         // printf("Execute %s\n", exec.Data());
+         exec.Form("((%s*) %p)->%s;", fCanv->ClassName(), fCanv, cdata + 4);
 
          gROOT->ProcessLine(exec);
       }
 
       return;
    }
-
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 /// assign canvas to the web socket
 /// connects with CanvasModified signal
 
-void THttpWSEngine::AssignCanvas(TCanvas* canv)
+void THttpWSEngine::AssignCanvas(TCanvas *canv)
 {
 
    if (fCanv != 0) {
@@ -208,5 +209,4 @@ void THttpWSEngine::AssignCanvas(TCanvas* canv)
       canv->GetListOfPrimitives()->Add(this);
       fCanv = canv;
    }
-
 }
diff --git a/net/http/src/THttpServer.cxx b/net/http/src/THttpServer.cxx
index a612721ca13d0..9a3d33b4319ab 100644
--- a/net/http/src/THttpServer.cxx
+++ b/net/http/src/THttpServer.cxx
@@ -1,6 +1,14 @@
 // $Id$
 // Author: Sergey Linev   21/12/2013
 
+/*************************************************************************
+ * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
 #include "THttpServer.h"
 
 #include "TThread.h"
@@ -24,7 +32,6 @@
 #include 
 #include 
 
-
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
 // THttpTimer                                                           //
@@ -34,16 +41,13 @@
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
 
-
 ////////////////////////////////////////////////////////////////////////////////
 
 class THttpTimer : public TTimer {
 public:
+   THttpServer *fServer; //!
 
-   THttpServer *fServer;  //!
-
-   THttpTimer(Long_t milliSec, Bool_t mode, THttpServer *serv) :
-      TTimer(milliSec, mode), fServer(serv)
+   THttpTimer(Long_t milliSec, Bool_t mode, THttpServer *serv) : TTimer(milliSec, mode), fServer(serv)
    {
       // construtor
    }
@@ -105,43 +109,29 @@ class THttpTimer : public TTimer {
 
 ClassImp(THttpServer)
 
-////////////////////////////////////////////////////////////////////////////////
-/// constructor
-
-THttpServer::THttpServer(const char *engine) :
-   TNamed("http", "ROOT http server"),
-   fEngines(),
-   fTimer(0),
-   fSniffer(0),
-   fMainThrdId(0),
-   fJSROOTSYS(),
-   fTopName("ROOT"),
-   fJSROOT(),
-   fLocations(),
-   fDefaultPage(),
-   fDefaultPageCont(),
-   fDrawPage(),
-   fDrawPageCont(),
-   fCallArgs()
+   ////////////////////////////////////////////////////////////////////////////////
+   /// constructor
+   ///
+   /// As argument, one specifies engine kind which should be
+   /// created like "http:8080". One could specify several engines
+   /// at once, separating them with ; like "http:8080;fastcgi:9000"
+   /// One also can configure readonly flag for sniffer like
+   /// "http:8080;readonly" or "http:8080;readwrite"
+   ///
+   /// Also searches for JavaScript ROOT sources, which are used in web clients
+   /// Typically JSROOT sources located in $ROOTSYS/etc/http directory,
+   /// but one could set JSROOTSYS variable to specify alternative location
+
+   THttpServer::THttpServer(const char *engine)
+   : TNamed("http", "ROOT http server"), fEngines(), fTimer(0), fSniffer(0), fMainThrdId(0), fJSROOTSYS(),
+     fTopName("ROOT"), fJSROOT(), fLocations(), fDefaultPage(), fDefaultPageCont(), fDrawPage(), fDrawPageCont(),
+     fCallArgs()
 {
-   // As argument, one specifies engine kind which should be
-   // created like "http:8080". One could specify several engines
-   // at once, separating them with ; like "http:8080;fastcgi:9000"
-   // One also can configure readonly flag for sniffer like
-   // "http:8080;readonly" or "http:8080;readwrite"
-   //
-   // Also searches for JavaScript ROOT sources, which are used in web clients
-   // Typically JSROOT sources located in $ROOTSYS/etc/http directory,
-   // but one could set JSROOTSYS variable to specify alternative location
-
    fLocations.SetOwner(kTRUE);
 
-   // Info("THttpServer", "Create %p in thrd %ld", this, (long) fMainThrdId);
-
 #ifdef COMPILED_WITH_DABC
    const char *dabcsys = gSystem->Getenv("DABCSYS");
-   if (dabcsys != 0)
-      fJSROOTSYS = TString::Format("%s/plugins/root/js", dabcsys);
+   if (dabcsys != 0) fJSROOTSYS = TString::Format("%s/plugins/root/js", dabcsys);
 #endif
 
    const char *jsrootsys = gSystem->Getenv("JSROOTSYS");
@@ -150,7 +140,8 @@ THttpServer::THttpServer(const char *engine) :
    if (fJSROOTSYS.Length() == 0) {
       TString jsdir = TString::Format("%s/http", TROOT::GetEtcDir().Data());
       if (gSystem->ExpandPathName(jsdir)) {
-         Warning("THttpServer", "problems resolving '%s', use JSROOTSYS to specify $ROOTSYS/etc/http location", jsdir.Data());
+         Warning("THttpServer", "problems resolving '%s', use JSROOTSYS to specify $ROOTSYS/etc/http location",
+                 jsdir.Data());
          fJSROOTSYS = ".";
       } else {
          fJSROOTSYS = jsdir;
@@ -237,9 +228,9 @@ void THttpServer::SetReadOnly(Bool_t readonly)
 
 void THttpServer::AddLocation(const char *prefix, const char *path)
 {
-   if ((prefix==0) || (*prefix==0)) return;
+   if ((prefix == 0) || (*prefix == 0)) return;
 
-   TNamed *obj = dynamic_cast (fLocations.FindObject(prefix));
+   TNamed *obj = dynamic_cast(fLocations.FindObject(prefix));
    if (obj != 0) {
       obj->SetTitle(path);
    } else {
@@ -256,7 +247,7 @@ void THttpServer::AddLocation(const char *prefix, const char *path)
 /// reduce load on THttpServer instance, also startup time can be improved
 /// When empty string specified (default), local copy of JSROOT is used (distributed with ROOT)
 
-void THttpServer::SetJSROOT(const char* location)
+void THttpServer::SetJSROOT(const char *location)
 {
    fJSROOT = location ? location : "";
 }
@@ -267,9 +258,9 @@ void THttpServer::SetJSROOT(const char* location)
 /// By default, $ROOTSYS/etc/http/files/online.htm page is used
 /// When empty filename is specified, default page will be used
 
-void THttpServer::SetDefaultPage(const char* filename)
+void THttpServer::SetDefaultPage(const char *filename)
 {
-   if ((filename!=0) && (*filename!=0))
+   if ((filename != 0) && (*filename != 0))
       fDefaultPage = filename;
    else
       fDefaultPage = fJSROOTSYS + "/files/online.htm";
@@ -284,9 +275,9 @@ void THttpServer::SetDefaultPage(const char* filename)
 /// By default, $ROOTSYS/etc/http/files/draw.htm page is used
 /// When empty filename is specified, default page will be used
 
-void THttpServer::SetDrawPage(const char* filename)
+void THttpServer::SetDrawPage(const char *filename)
 {
-   if ((filename!=0) && (*filename!=0))
+   if ((filename != 0) && (*filename != 0))
       fDrawPage = filename;
    else
       fDrawPage = fJSROOTSYS + "/files/draw.htm";
@@ -298,7 +289,7 @@ void THttpServer::SetDrawPage(const char* filename)
 ////////////////////////////////////////////////////////////////////////////////
 /// factory method to create different http engines
 /// At the moment two engine kinds are supported:
-///  civetweb (default) and fastcgi
+///   civetweb (default) and fastcgi
 /// Examples:
 ///   "civetweb:8080" or "http:8080" or ":8080" - creates civetweb web server with http port 8080
 ///   "fastcgi:9000" - creates fastcgi server with port 9000
@@ -326,7 +317,7 @@ Bool_t THttpServer::CreateEngine(const char *engine)
    TClass *engine_class = gROOT->LoadClass(clname.Data());
    if (engine_class == 0) return kFALSE;
 
-   THttpEngine *eng = (THttpEngine *) engine_class->New();
+   THttpEngine *eng = (THttpEngine *)engine_class->New();
    if (eng == 0) return kFALSE;
 
    eng->SetServer(this);
@@ -388,14 +379,14 @@ Bool_t THttpServer::VerifyFilePath(const char *fname)
       }
 
       // ignore current directory
-      if ((next == fname + 1) && (*fname == '.'))  {
+      if ((next == fname + 1) && (*fname == '.')) {
          fname += 2;
          continue;
       }
 
       // ignore slash at the front
       if (next == fname) {
-         fname ++;
+         fname++;
          continue;
       }
 
@@ -421,13 +412,13 @@ Bool_t THttpServer::IsFileRequested(const char *uri, TString &res) const
 
    TIter iter(&fLocations);
    TObject *obj(0);
-   while ((obj=iter()) != 0) {
+   while ((obj = iter()) != 0) {
       Ssiz_t pos = fname.Index(obj->GetName());
       if (pos == kNPOS) continue;
       fname.Remove(0, pos + (strlen(obj->GetName()) - 1));
       if (!VerifyFilePath(fname.Data())) return kFALSE;
       res = obj->GetTitle();
-      if ((fname[0]=='/') && (res[res.Length()-1]=='/')) res.Resize(res.Length()-1);
+      if ((fname[0] == '/') && (res[res.Length() - 1] == '/')) res.Resize(res.Length() - 1);
       res.Append(fname);
       return kTRUE;
    }
@@ -442,7 +433,7 @@ Bool_t THttpServer::IsFileRequested(const char *uri, TString &res) const
 
 Bool_t THttpServer::ExecuteHttp(THttpCallArg *arg)
 {
-   if ((fMainThrdId!=0) && (fMainThrdId == TThread::SelfId())) {
+   if ((fMainThrdId != 0) && (fMainThrdId == TThread::SelfId())) {
       // should not happen, but one could process requests directly without any signaling
 
       ProcessRequest(arg);
@@ -467,7 +458,7 @@ Bool_t THttpServer::ExecuteHttp(THttpCallArg *arg)
 
 void THttpServer::ProcessRequests()
 {
-   if (fMainThrdId==0) fMainThrdId = TThread::SelfId();
+   if (fMainThrdId == 0) fMainThrdId = TThread::SelfId();
 
    if (fMainThrdId != TThread::SelfId()) {
       Error("ProcessRequests", "Should be called only from main ROOT thread");
@@ -480,7 +471,7 @@ void THttpServer::ProcessRequests()
 
       lk.lock();
       if (fCallArgs.GetSize() > 0) {
-         arg = (THttpCallArg *) fCallArgs.First();
+         arg = (THttpCallArg *)fCallArgs.First();
          fCallArgs.RemoveFirst();
       }
       lk.unlock();
@@ -502,8 +493,7 @@ void THttpServer::ProcessRequests()
    // regularly call Process() method of engine to let perform actions in ROOT context
    TIter iter(&fEngines);
    THttpEngine *engine = 0;
-   while ((engine = (THttpEngine *)iter()) != 0)
-      engine->Process();
+   while ((engine = (THttpEngine *)iter()) != 0) engine->Process();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -531,7 +521,7 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
          // replace all references on JSROOT
          if (fJSROOT.Length() > 0) {
             TString repl = TString("=\"") + fJSROOT;
-            if (!repl.EndsWith("/")) repl+="/";
+            if (!repl.EndsWith("/")) repl += "/";
             arg->fContent.ReplaceAll("=\"jsrootsys/", repl);
          }
 
@@ -547,7 +537,8 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
 
             arg->fContent.ReplaceAll(hjsontag, h_json);
 
-            arg->AddHeader("Cache-Control", "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
+            arg->AddHeader("Cache-Control",
+                           "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
             if (arg->fQuery.Index("nozip") == kNPOS) arg->SetZipping(2);
          }
          arg->SetContentType("text/html");
@@ -574,7 +565,7 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
          // replace all references on JSROOT
          if (fJSROOT.Length() > 0) {
             TString repl = TString("=\"") + fJSROOT;
-            if (!repl.EndsWith("/")) repl+="/";
+            if (!repl.EndsWith("/")) repl += "/";
             arg->fContent.ReplaceAll("=\"jsrootsys/", repl);
          }
 
@@ -596,7 +587,8 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
                arg->fContent.ReplaceAll(rootjsontag, str);
             }
          }
-         arg->AddHeader("Cache-Control", "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
+         arg->AddHeader("Cache-Control",
+                        "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
          if (arg->fQuery.Index("nozip") == kNPOS) arg->SetZipping(2);
          arg->SetContentType("text/html");
       }
@@ -616,10 +608,10 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
       iszip = kTRUE;
    }
 
-   void* bindata(0);
+   void *bindata(0);
    Long_t bindatalen(0);
 
-   if ((filename == "h.xml") || (filename == "get.xml"))  {
+   if ((filename == "h.xml") || (filename == "get.xml")) {
 
       Bool_t compact = arg->fQuery.Index("compact") != kNPOS;
 
@@ -639,55 +631,46 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
       if (!compact) arg->fContent.Append("\n");
 
       arg->SetXml();
-   } else
-
-   if (filename == "h.json")  {
+   } else if (filename == "h.json") {
       TRootSnifferStoreJson store(arg->fContent, arg->fQuery.Index("compact") != kNPOS);
       const char *topname = fTopName.Data();
       if (arg->fTopName.Length() > 0) topname = arg->fTopName.Data();
       fSniffer->ScanHierarchy(topname, arg->fPathName.Data(), &store);
       arg->SetJson();
-   } else
-
-   if (filename == "root.websocket") {
+   } else if (filename == "root.websocket") {
       // handling of web socket
 
-      TCanvas* canv = dynamic_cast (fSniffer->FindTObjectInHierarchy(arg->fPathName.Data()));
+      TCanvas *canv = dynamic_cast(fSniffer->FindTObjectInHierarchy(arg->fPathName.Data()));
 
       if (canv == 0) {
          // for the moment only TCanvas is used for web sockets
          arg->Set404();
-      } else
-      if (strcmp(arg->GetMethod(),"WS_CONNECT")==0) {
-
+      } else if (strcmp(arg->GetMethod(), "WS_CONNECT") == 0) {
          if (canv->GetPrimitive("websocket")) {
             // websocket already exists, ignore all other requests
             arg->Set404();
          }
-      } else
-      if (strcmp(arg->GetMethod(),"WS_READY")==0) {
-         THttpWSEngine* wshandle = dynamic_cast (arg->TakeWSHandle());
+      } else if (strcmp(arg->GetMethod(), "WS_READY") == 0) {
+         THttpWSEngine *wshandle = dynamic_cast(arg->TakeWSHandle());
 
-         if (gDebug>0) Info("ProcessRequest","Set WebSocket handle %p", wshandle);
+         if (gDebug > 0) Info("ProcessRequest", "Set WebSocket handle %p", wshandle);
 
          if (wshandle) wshandle->AssignCanvas(canv);
 
          // connection is established
-      } else
-      if (strcmp(arg->GetMethod(),"WS_DATA")==0) {
+      } else if (strcmp(arg->GetMethod(), "WS_DATA") == 0) {
          // process received data
 
-         THttpWSEngine* wshandle = dynamic_cast (canv->GetPrimitive("websocket"));
+         THttpWSEngine *wshandle = dynamic_cast(canv->GetPrimitive("websocket"));
          if (wshandle) wshandle->ProcessData(arg);
 
-      } else
-      if (strcmp(arg->GetMethod(),"WS_CLOSE")==0) {
+      } else if (strcmp(arg->GetMethod(), "WS_CLOSE") == 0) {
          // connection is closed, one can remove handle
 
-         THttpWSEngine* wshandle = dynamic_cast (canv->GetPrimitive("websocket"));
+         THttpWSEngine *wshandle = dynamic_cast(canv->GetPrimitive("websocket"));
 
          if (wshandle) {
-            if (gDebug>0) Info("ProcessRequest","Clear WebSocket handle");
+            if (gDebug > 0) Info("ProcessRequest", "Clear WebSocket handle");
             wshandle->ClearHandle();
             wshandle->AssignCanvas(0);
             delete wshandle;
@@ -698,9 +681,8 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
 
       return;
 
-   } else
-
-   if (fSniffer->Produce(arg->fPathName.Data(), filename.Data(), arg->fQuery.Data(), bindata, bindatalen, arg->fContent)) {
+   } else if (fSniffer->Produce(arg->fPathName.Data(), filename.Data(), arg->fQuery.Data(), bindata, bindatalen,
+                                arg->fContent)) {
       if (bindata != 0) arg->SetBinData(bindata, bindatalen);
 
       // define content type base on extension
@@ -718,11 +700,12 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
       // only for binary data master version is important
       // it allows to detect if streamer info was modified
       const char *parname = fSniffer->IsStreamerInfoItem(arg->fPathName.Data()) ? "BVersion" : "MVersion";
-      arg->AddHeader(parname, Form("%u", (unsigned) fSniffer->GetStreamerInfoHash()));
+      arg->AddHeader(parname, Form("%u", (unsigned)fSniffer->GetStreamerInfoHash()));
    }
 
    // try to avoid caching on the browser
-   arg->AddHeader("Cache-Control", "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
+   arg->AddHeader("Cache-Control",
+                  "private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -750,7 +733,7 @@ Bool_t THttpServer::Unregister(TObject *obj)
 ///
 /// See TRootSniffer::Restrict() for more details
 
-void THttpServer::Restrict(const char *path, const char* options)
+void THttpServer::Restrict(const char *path, const char *options)
 {
    fSniffer->Restrict(path, options);
 }
@@ -793,7 +776,7 @@ Bool_t THttpServer::RegisterCommand(const char *cmdname, const char *method, con
 
 Bool_t THttpServer::Hide(const char *foldername, Bool_t hide)
 {
-   return SetItemField(foldername, "_hidden", hide ? "true" : (const char *) 0);
+   return SetItemField(foldername, "_hidden", hide ? "true" : (const char *)0);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -837,57 +820,55 @@ const char *THttpServer::GetMimeType(const char *path)
       const char *extension;
       int ext_len;
       const char *mime_type;
-   } builtin_mime_types[] = {
-      {".xml", 4, "text/xml"},
-      {".json", 5, "application/json"},
-      {".bin", 4, "application/x-binary"},
-      {".gif", 4, "image/gif"},
-      {".jpg", 4, "image/jpeg"},
-      {".png", 4, "image/png"},
-      {".html", 5, "text/html"},
-      {".htm", 4, "text/html"},
-      {".shtm", 5, "text/html"},
-      {".shtml", 6, "text/html"},
-      {".css", 4, "text/css"},
-      {".js",  3, "application/x-javascript"},
-      {".ico", 4, "image/x-icon"},
-      {".jpeg", 5, "image/jpeg"},
-      {".svg", 4, "image/svg+xml"},
-      {".txt", 4, "text/plain"},
-      {".torrent", 8, "application/x-bittorrent"},
-      {".wav", 4, "audio/x-wav"},
-      {".mp3", 4, "audio/x-mp3"},
-      {".mid", 4, "audio/mid"},
-      {".m3u", 4, "audio/x-mpegurl"},
-      {".ogg", 4, "application/ogg"},
-      {".ram", 4, "audio/x-pn-realaudio"},
-      {".xslt", 5, "application/xml"},
-      {".xsl", 4, "application/xml"},
-      {".ra",  3, "audio/x-pn-realaudio"},
-      {".doc", 4, "application/msword"},
-      {".exe", 4, "application/octet-stream"},
-      {".zip", 4, "application/x-zip-compressed"},
-      {".xls", 4, "application/excel"},
-      {".tgz", 4, "application/x-tar-gz"},
-      {".tar", 4, "application/x-tar"},
-      {".gz",  3, "application/x-gunzip"},
-      {".arj", 4, "application/x-arj-compressed"},
-      {".rar", 4, "application/x-arj-compressed"},
-      {".rtf", 4, "application/rtf"},
-      {".pdf", 4, "application/pdf"},
-      {".swf", 4, "application/x-shockwave-flash"},
-      {".mpg", 4, "video/mpeg"},
-      {".webm", 5, "video/webm"},
-      {".mpeg", 5, "video/mpeg"},
-      {".mov", 4, "video/quicktime"},
-      {".mp4", 4, "video/mp4"},
-      {".m4v", 4, "video/x-m4v"},
-      {".asf", 4, "video/x-ms-asf"},
-      {".avi", 4, "video/x-msvideo"},
-      {".bmp", 4, "image/bmp"},
-      {".ttf", 4, "application/x-font-ttf"},
-      {NULL,  0, NULL}
-   };
+   } builtin_mime_types[] = {{".xml", 4, "text/xml"},
+                             {".json", 5, "application/json"},
+                             {".bin", 4, "application/x-binary"},
+                             {".gif", 4, "image/gif"},
+                             {".jpg", 4, "image/jpeg"},
+                             {".png", 4, "image/png"},
+                             {".html", 5, "text/html"},
+                             {".htm", 4, "text/html"},
+                             {".shtm", 5, "text/html"},
+                             {".shtml", 6, "text/html"},
+                             {".css", 4, "text/css"},
+                             {".js", 3, "application/x-javascript"},
+                             {".ico", 4, "image/x-icon"},
+                             {".jpeg", 5, "image/jpeg"},
+                             {".svg", 4, "image/svg+xml"},
+                             {".txt", 4, "text/plain"},
+                             {".torrent", 8, "application/x-bittorrent"},
+                             {".wav", 4, "audio/x-wav"},
+                             {".mp3", 4, "audio/x-mp3"},
+                             {".mid", 4, "audio/mid"},
+                             {".m3u", 4, "audio/x-mpegurl"},
+                             {".ogg", 4, "application/ogg"},
+                             {".ram", 4, "audio/x-pn-realaudio"},
+                             {".xslt", 5, "application/xml"},
+                             {".xsl", 4, "application/xml"},
+                             {".ra", 3, "audio/x-pn-realaudio"},
+                             {".doc", 4, "application/msword"},
+                             {".exe", 4, "application/octet-stream"},
+                             {".zip", 4, "application/x-zip-compressed"},
+                             {".xls", 4, "application/excel"},
+                             {".tgz", 4, "application/x-tar-gz"},
+                             {".tar", 4, "application/x-tar"},
+                             {".gz", 3, "application/x-gunzip"},
+                             {".arj", 4, "application/x-arj-compressed"},
+                             {".rar", 4, "application/x-arj-compressed"},
+                             {".rtf", 4, "application/rtf"},
+                             {".pdf", 4, "application/pdf"},
+                             {".swf", 4, "application/x-shockwave-flash"},
+                             {".mpg", 4, "video/mpeg"},
+                             {".webm", 5, "video/webm"},
+                             {".mpeg", 5, "video/mpeg"},
+                             {".mov", 4, "video/quicktime"},
+                             {".mp4", 4, "video/mp4"},
+                             {".m4v", 4, "video/x-m4v"},
+                             {".asf", 4, "video/x-ms-asf"},
+                             {".avi", 4, "video/x-msvideo"},
+                             {".bmp", 4, "image/bmp"},
+                             {".ttf", 4, "application/x-font-ttf"},
+                             {NULL, 0, NULL}};
 
    int path_len = strlen(path);
 
@@ -916,7 +897,7 @@ char *THttpServer::ReadFileContent(const char *filename, Int_t &len)
    len = is.tellg();
    is.seekg(0, is.beg);
 
-   char *buf = (char *) malloc(len);
+   char *buf = (char *)malloc(len);
    is.read(buf, len);
    if (!is) {
       free(buf);
diff --git a/net/http/src/TRootSniffer.cxx b/net/http/src/TRootSniffer.cxx
index b38d29fde999f..253ef1918d881 100644
--- a/net/http/src/TRootSniffer.cxx
+++ b/net/http/src/TRootSniffer.cxx
@@ -1,6 +1,14 @@
 // $Id$
 // Author: Sergey Linev   22/12/2013
 
+/*************************************************************************
+ * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
 #include "TRootSniffer.h"
 
 #include "TH1.h"
@@ -53,9 +61,6 @@ const char *item_prop_user = "_username";
 const char *item_prop_autoload = "_autoload";
 const char *item_prop_rootversion = "_root_version";
 
-
-// ============================================================================
-
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
 // TRootSnifferScanRec                                                  //
@@ -68,19 +73,9 @@ const char *item_prop_rootversion = "_root_version";
 ////////////////////////////////////////////////////////////////////////////////
 /// constructor
 
-TRootSnifferScanRec::TRootSnifferScanRec() :
-   fParent(0),
-   fMask(0),
-   fSearchPath(0),
-   fLevel(0),
-   fItemName(),
-   fItemsNames(),
-   fRestriction(0),
-   fStore(0),
-   fHasMore(kFALSE),
-   fNodeStarted(kFALSE),
-   fNumFields(0),
-   fNumChilds(0)
+TRootSnifferScanRec::TRootSnifferScanRec()
+   : fParent(0), fMask(0), fSearchPath(0), fLevel(0), fItemName(), fItemsNames(), fRestriction(0), fStore(0),
+     fHasMore(kFALSE), fNodeStarted(kFALSE), fNumFields(0), fNumChilds(0)
 {
    fItemsNames.SetOwner(kTRUE);
 }
@@ -124,8 +119,7 @@ void TRootSnifferScanRec::MakeItemName(const char *objname, TString &itemname)
    size_t pos;
 
    // replace all special symbols which can make problem to navigate in hierarchy
-   while ((pos = nnn.find_first_of("- []<>#:&?/\'\"\\")) != std::string::npos)
-      nnn.replace(pos, 1, "_");
+   while ((pos = nnn.find_first_of("- []<>#:&?/\'\"\\")) != std::string::npos) nnn.replace(pos, 1, "_");
 
    itemname = nnn.c_str();
    Int_t cnt = 0;
@@ -140,7 +134,7 @@ void TRootSnifferScanRec::MakeItemName(const char *objname, TString &itemname)
 ////////////////////////////////////////////////////////////////////////////////
 /// Produce full name, including all parents
 
-void TRootSnifferScanRec::BuildFullName(TString& buf, TRootSnifferScanRec* prnt)
+void TRootSnifferScanRec::BuildFullName(TString &buf, TRootSnifferScanRec *prnt)
 {
    if (!prnt) prnt = fParent;
 
@@ -152,7 +146,6 @@ void TRootSnifferScanRec::BuildFullName(TString& buf, TRootSnifferScanRec* prnt)
    }
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// creates new node with specified name
 /// if special symbols like "[]&<>" are used, node name
@@ -189,8 +182,7 @@ void TRootSnifferScanRec::CloseNode()
 
 void TRootSnifferScanRec::SetRootClass(TClass *cl)
 {
-   if ((cl != 0) && CanSetFields())
-      SetField(item_prop_kind, TString::Format("ROOT.%s", cl->GetName()));
+   if ((cl != 0) && CanSetFields()) SetField(item_prop_kind, TString::Format("ROOT.%s", cl->GetName()));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -199,15 +191,11 @@ void TRootSnifferScanRec::SetRootClass(TClass *cl)
 
 Bool_t TRootSnifferScanRec::Done() const
 {
-   if (fStore == 0)
-      return kFALSE;
+   if (fStore == 0) return kFALSE;
 
-   if ((fMask & kSearch) && fStore->GetResPtr())
-      return kTRUE;
+   if ((fMask & kSearch) && fStore->GetResPtr()) return kTRUE;
 
-   if ((fMask & kCheckChilds) && fStore->GetResPtr() &&
-         (fStore->GetResNumChilds() >= 0))
-      return kTRUE;
+   if ((fMask & kCheckChilds) && fStore->GetResPtr() && (fStore->GetResNumChilds() >= 0)) return kTRUE;
 
    return kFALSE;
 }
@@ -237,9 +225,10 @@ Bool_t TRootSnifferScanRec::IsReadyForResult() const
 
 Bool_t TRootSnifferScanRec::SetResult(void *obj, TClass *cl, TDataMember *member)
 {
-   if (member==0) return SetFoundResult(obj, cl);
+   if (member == 0) return SetFoundResult(obj, cl);
 
-   fStore->Error("SetResult", "When member specified, pointer on object (not member) should be provided; use SetFoundResult");
+   fStore->Error("SetResult",
+                 "When member specified, pointer on object (not member) should be provided; use SetFoundResult");
    return kFALSE;
 }
 
@@ -258,7 +247,6 @@ Bool_t TRootSnifferScanRec::SetFoundResult(void *obj, TClass *cl, TDataMember *m
    return Done();
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// returns current depth of scanned hierarchy
 
@@ -296,9 +284,9 @@ Bool_t TRootSnifferScanRec::CanExpandItem()
 
 Bool_t TRootSnifferScanRec::IsReadOnly(Bool_t dflt)
 {
-   if (fRestriction==0) return dflt;
+   if (fRestriction == 0) return dflt;
 
-   return fRestriction!=2;
+   return fRestriction != 2;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -307,8 +295,8 @@ Bool_t TRootSnifferScanRec::IsReadOnly(Bool_t dflt)
 /// If required, all necessary nodes and fields will be created
 /// Used when different collection kinds should be scanned
 
-Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
-                                     const char *obj_name, TRootSniffer* sniffer)
+Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj, const char *obj_name,
+                                     TRootSniffer *sniffer)
 {
    if (super.Done()) return kFALSE;
 
@@ -336,7 +324,7 @@ Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
       TString fullname;
       BuildFullName(fullname, &super);
       fRestriction = sniffer->CheckRestriction(fullname.Data());
-      if (fRestriction<0) return kFALSE;
+      if (fRestriction < 0) return kFALSE;
    }
 
    fParent = &super;
@@ -344,7 +332,7 @@ Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
    fStore = super.fStore;
    fSearchPath = super.fSearchPath;
    fMask = super.fMask & kActions;
-   if (fRestriction==0) fRestriction = super.fRestriction; // get restriction from parent
+   if (fRestriction == 0) fRestriction = super.fRestriction; // get restriction from parent
    Bool_t topelement(kFALSE);
 
    if (fMask & kScan) {
@@ -355,8 +343,7 @@ Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
    } else {
       if (fSearchPath == 0) return kFALSE;
 
-      if (strncmp(fSearchPath, fItemName.Data(), fItemName.Length()) != 0)
-         return kFALSE;
+      if (strncmp(fSearchPath, fItemName.Data(), fItemName.Length()) != 0) return kFALSE;
 
       const char *separ = fSearchPath + fItemName.Length();
 
@@ -381,22 +368,17 @@ Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
 
    CreateNode(fItemName.Data());
 
-   if ((obj_name != 0) && (fItemName != obj_name))
-      SetField(item_prop_realname, obj_name);
+   if ((obj_name != 0) && (fItemName != obj_name)) SetField(item_prop_realname, obj_name);
 
-   if (full_name != 0)
-      SetField("_fullname", full_name);
+   if (full_name != 0) SetField("_fullname", full_name);
 
-   if (topelement)
-      SetField(item_prop_rootversion, TString::Format("%d",ROOT_VERSION_CODE));
+   if (topelement) SetField(item_prop_rootversion, TString::Format("%d", ROOT_VERSION_CODE));
 
-   if (topelement && sniffer->GetAutoLoad())
-      SetField(item_prop_autoload, sniffer->GetAutoLoad());
+   if (topelement && sniffer->GetAutoLoad()) SetField(item_prop_autoload, sniffer->GetAutoLoad());
 
    return kTRUE;
 }
 
-
 // ====================================================================
 
 //////////////////////////////////////////////////////////////////////////
@@ -413,21 +395,12 @@ Bool_t TRootSnifferScanRec::GoInside(TRootSnifferScanRec &super, TObject *obj,
 
 ClassImp(TRootSniffer)
 
-////////////////////////////////////////////////////////////////////////////////
-/// constructor
+   ////////////////////////////////////////////////////////////////////////////////
+   /// constructor
 
-TRootSniffer::TRootSniffer(const char *name, const char *objpath) :
-   TNamed(name, "sniffer of root objects"),
-   fObjectsPath(objpath),
-   fMemFile(0),
-   fSinfo(0),
-   fReadOnly(kTRUE),
-   fScanGlobalDir(kTRUE),
-   fCurrentArg(0),
-   fCurrentRestrict(0),
-   fCurrentAllowedMethods(0),
-   fRestrictions(),
-   fAutoLoad()
+   TRootSniffer::TRootSniffer(const char *name, const char *objpath)
+   : TNamed(name, "sniffer of root objects"), fObjectsPath(objpath), fMemFile(0), fSinfo(0), fReadOnly(kTRUE),
+     fScanGlobalDir(kTRUE), fCurrentArg(0), fCurrentRestrict(0), fCurrentAllowedMethods(0), fRestrictions(), fAutoLoad()
 {
    fRestrictions.SetOwner(kTRUE);
 }
@@ -454,7 +427,7 @@ TRootSniffer::~TRootSniffer()
 /// depending from restrictions some objects will be invisible
 /// or user get full access to the element
 
-void TRootSniffer::SetCurrentCallArg(THttpCallArg* arg)
+void TRootSniffer::SetCurrentCallArg(THttpCallArg *arg)
 {
    fCurrentArg = arg;
    fCurrentRestrict = 0;
@@ -478,13 +451,13 @@ void TRootSniffer::SetCurrentCallArg(THttpCallArg* arg)
 /// Or fully hide command from guest account
 ///    sniff->Restrict("/CmdRebin","hidden=guest");
 
-void TRootSniffer::Restrict(const char* path, const char* options)
+void TRootSniffer::Restrict(const char *path, const char *options)
 {
-   const char* rslash = strrchr(path,'/');
+   const char *rslash = strrchr(path, '/');
    if (rslash) rslash++;
-   if ((rslash==0) || (*rslash==0)) rslash = path;
+   if ((rslash == 0) || (*rslash == 0)) rslash = path;
 
-   fRestrictions.Add(new TNamed(rslash, TString::Format("%s%s%s", path,"%%%",options).Data()));
+   fRestrictions.Add(new TNamed(rslash, TString::Format("%s%s%s", path, "%%%", options).Data()));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -492,15 +465,15 @@ void TRootSniffer::Restrict(const char* path, const char* options)
 /// to top element of h.json/h.hml requests
 /// Used to instruct browser automatically load special code
 
-void TRootSniffer::SetAutoLoad(const char* scripts)
+void TRootSniffer::SetAutoLoad(const char *scripts)
 {
-   fAutoLoad = scripts!=0 ? scripts : "";
+   fAutoLoad = scripts != 0 ? scripts : "";
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 /// return name of configured autoload scripts (or 0)
 
-const char* TRootSniffer::GetAutoLoad() const
+const char *TRootSniffer::GetAutoLoad() const
 {
    return fAutoLoad.Length() > 0 ? fAutoLoad.Data() : 0;
 }
@@ -509,11 +482,11 @@ const char* TRootSniffer::GetAutoLoad() const
 /// Made fast check if item with specified name is in restriction list
 /// If returns true, requires precise check with CheckRestriction() method
 
-Bool_t TRootSniffer::HasRestriction(const char* item_name)
+Bool_t TRootSniffer::HasRestriction(const char *item_name)
 {
-   if ((item_name==0) || (*item_name==0) || (fCurrentArg==0)) return kFALSE;
+   if ((item_name == 0) || (*item_name == 0) || (fCurrentArg == 0)) return kFALSE;
 
-   return fRestrictions.FindObject(item_name)!=0;
+   return fRestrictions.FindObject(item_name) != 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -521,19 +494,19 @@ Bool_t TRootSniffer::HasRestriction(const char* item_name)
 /// return 1 when option==all
 /// return 0 when option does not match user name
 
-Int_t TRootSniffer::WithCurrentUserName(const char* option)
+Int_t TRootSniffer::WithCurrentUserName(const char *option)
 {
-   const char* username = fCurrentArg ? fCurrentArg->GetUserName() : 0;
+   const char *username = fCurrentArg ? fCurrentArg->GetUserName() : 0;
 
-   if ((username==0) || (option == 0) || (*option==0)) return 0;
+   if ((username == 0) || (option == 0) || (*option == 0)) return 0;
 
-   if (strcmp(option,"all") == 0) return 1;
+   if (strcmp(option, "all") == 0) return 1;
 
    if (strcmp(username, option) == 0) return 2;
 
    if (strstr(option, username) == 0) return -1;
 
-   TObjArray* arr = TString(option).Tokenize(",");
+   TObjArray *arr = TString(option).Tokenize(",");
 
    Bool_t find = arr->FindObject(username) != 0;
 
@@ -551,45 +524,51 @@ Int_t TRootSniffer::WithCurrentUserName(const char* option)
 ///          1 - read-only access
 ///          2 - full access
 
-Int_t TRootSniffer::CheckRestriction(const char* full_item_name)
+Int_t TRootSniffer::CheckRestriction(const char *full_item_name)
 {
-   if ((full_item_name==0) || (*full_item_name==0)) return 0;
+   if ((full_item_name == 0) || (*full_item_name == 0)) return 0;
 
-   const char* item_name = strrchr(full_item_name,'/');
+   const char *item_name = strrchr(full_item_name, '/');
    if (item_name) item_name++;
-   if ((item_name==0) || (*item_name==0)) item_name = full_item_name;
+   if ((item_name == 0) || (*item_name == 0)) item_name = full_item_name;
 
    TString pattern1 = TString("*/") + item_name + "%%%";
    TString pattern2 = TString(full_item_name) + "%%%";
 
-   const char* options = 0;
+   const char *options = 0;
    TIter iter(&fRestrictions);
-   TObject* obj;
+   TObject *obj;
 
    while ((obj = iter()) != 0) {
-      const char* title = obj->GetTitle();
+      const char *title = obj->GetTitle();
 
-      if (strstr(title,pattern1.Data())==title) { options = title + pattern1.Length(); break; }
-      if (strstr(title,pattern2.Data())==title) { options = title + pattern2.Length(); break; }
+      if (strstr(title, pattern1.Data()) == title) {
+         options = title + pattern1.Length();
+         break;
+      }
+      if (strstr(title, pattern2.Data()) == title) {
+         options = title + pattern2.Length();
+         break;
+      }
    }
 
-   if (options==0) return 0;
+   if (options == 0) return 0;
 
    TUrl url;
    url.SetOptions(options);
    url.ParseOptions();
 
-   Int_t can_see = WithCurrentUserName(url.GetValueFromOptions("visible")) -
-                   WithCurrentUserName(url.GetValueFromOptions("hidden"));
+   Int_t can_see =
+      WithCurrentUserName(url.GetValueFromOptions("visible")) - WithCurrentUserName(url.GetValueFromOptions("hidden"));
 
-   Int_t can_access = WithCurrentUserName(url.GetValueFromOptions("allow")) -
-                      WithCurrentUserName(url.GetValueFromOptions("readonly"));
+   Int_t can_access =
+      WithCurrentUserName(url.GetValueFromOptions("allow")) - WithCurrentUserName(url.GetValueFromOptions("readonly"));
 
    if (can_access > 0) return 2; // first of all, if access enabled, provide it
-   if (can_see < 0) return -1; // if object to be hidden, do it
+   if (can_see < 0) return -1;   // if object to be hidden, do it
 
-   const char* methods = url.GetValueFromOptions("allow_method");
-   if (methods!=0) fCurrentAllowedMethods = methods;
+   const char *methods = url.GetValueFromOptions("allow_method");
+   if (methods != 0) fCurrentAllowedMethods = methods;
 
    if (can_access < 0) return 1; // read-only access
 
@@ -612,21 +591,20 @@ void TRootSniffer::ScanObjectMembers(TRootSnifferScanRec &rec, TClass *cl, char
    TIter iter(cl->GetListOfRealData());
    while ((obj = iter()) != 0) {
       TRealData *rdata = dynamic_cast(obj);
-      if ((rdata == 0) || strchr(rdata->GetName(),'.')) continue;
+      if ((rdata == 0) || strchr(rdata->GetName(), '.')) continue;
 
       TDataMember *member = rdata->GetDataMember();
       // exclude enum or static variables
       if ((member == 0) || (member->Property() & (kIsStatic | kIsEnum | kIsUnion))) continue;
       char *member_ptr = ptr + rdata->GetThisOffset();
 
-      if (member->IsaPointer()) member_ptr = *((char **) member_ptr);
+      if (member->IsaPointer()) member_ptr = *((char **)member_ptr);
 
       TRootSnifferScanRec chld;
 
       if (chld.GoInside(rec, member, 0, this)) {
 
-         TClass *mcl = (member->IsBasic() || member->IsSTLContainer()) ? 0 :
-                       gROOT->GetClass(member->GetTypeName());
+         TClass *mcl = (member->IsBasic() || member->IsSTLContainer()) ? 0 : gROOT->GetClass(member->GetTypeName());
 
          Int_t coll_offset = mcl ? mcl->GetBaseClassOffset(TCollection::Class()) : -1;
          if (coll_offset >= 0) {
@@ -637,11 +615,9 @@ void TRootSniffer::ScanObjectMembers(TRootSnifferScanRec &rec, TClass *cl, char
          if (chld.SetFoundResult(ptr, cl, member)) break;
 
          const char *title = member->GetTitle();
-         if ((title != 0) && (strlen(title) != 0))
-            chld.SetField(item_prop_title, title);
+         if ((title != 0) && (strlen(title) != 0)) chld.SetField(item_prop_title, title);
 
-         if (member->GetTypeName())
-            chld.SetField(item_prop_typename, member->GetTypeName());
+         if (member->GetTypeName()) chld.SetField(item_prop_typename, member->GetTypeName());
 
          if (member->GetArrayDim() > 0) {
             // store array dimensions in form [N1,N2,N3,...]
@@ -652,12 +628,11 @@ void TRootSniffer::ScanObjectMembers(TRootSnifferScanRec &rec, TClass *cl, char
             }
             dim.Append("]");
             chld.SetField(item_prop_arraydim, dim, kFALSE);
-         } else
-         if (member->GetArrayIndex()!=0) {
+         } else if (member->GetArrayIndex() != 0) {
             TRealData *idata = cl->GetRealData(member->GetArrayIndex());
-            TDataMember *imember = (idata!=0) ? idata->GetDataMember() : 0;
-            if ((imember!=0) && (strcmp(imember->GetTrueTypeName(),"int")==0)) {
-               Int_t arraylen = *((int *) (ptr + idata->GetThisOffset()));
+            TDataMember *imember = (idata != 0) ? idata->GetDataMember() : 0;
+            if ((imember != 0) && (strcmp(imember->GetTrueTypeName(), "int") == 0)) {
+               Int_t arraylen = *((int *)(ptr + idata->GetThisOffset()));
                chld.SetField(item_prop_arraydim, TString::Format("[%d]", arraylen), kFALSE);
             }
          }
@@ -687,7 +662,7 @@ void TRootSniffer::ScanObjectMembers(TRootSnifferScanRec &rec, TClass *cl, char
 
 void TRootSniffer::ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj)
 {
-   TClass* cl = obj ? obj->IsA() : 0;
+   TClass *cl = obj ? obj->IsA() : 0;
 
    if (cl && cl->InheritsFrom(TLeaf::Class())) {
       rec.SetField("_more", "false");
@@ -695,27 +670,30 @@ void TRootSniffer::ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj)
       return;
    }
 
-   const char* pos = strstr(cl ? cl->GetTitle() : "", "*SNIFF*");
-   if (pos==0) return;
+   const char *pos = strstr(cl ? cl->GetTitle() : "", "*SNIFF*");
+   if (pos == 0) return;
 
    pos += 7;
    while (*pos != 0) {
-     if (*pos == ' ') { pos++; continue; }
-     // first locate identifier
-     const char* pos0 = pos;
-     while ((*pos != 0) && (*pos != '=')) pos++;
-     if (*pos == 0) return;
-     TString name(pos0, pos-pos0);
-     pos++;
-     Bool_t quotes = (*pos == '\"');
-     if (quotes) pos++;
-     pos0 = pos;
-     // then value with or without quotes
-     while ((*pos != 0) && (*pos != (quotes ? '\"' : ' '))) pos++;
-     TString value(pos0, pos-pos0);
-     rec.SetField(name, value);
-     if (quotes) pos++;
-     pos++;
+      if (*pos == ' ') {
+         pos++;
+         continue;
+      }
+      // first locate identifier
+      const char *pos0 = pos;
+      while ((*pos != 0) && (*pos != '=')) pos++;
+      if (*pos == 0) return;
+      TString name(pos0, pos - pos0);
+      pos++;
+      Bool_t quotes = (*pos == '\"');
+      if (quotes) pos++;
+      pos0 = pos;
+      // then value with or without quotes
+      while ((*pos != 0) && (*pos != (quotes ? '\"' : ' '))) pos++;
+      TString value(pos0, pos - pos0);
+      rec.SetField(name, value);
+      if (quotes) pos++;
+      pos++;
    }
 }
 
@@ -726,28 +704,28 @@ void TRootSniffer::ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj)
 void TRootSniffer::ScanObjectChilds(TRootSnifferScanRec &rec, TObject *obj)
 {
    if (obj->InheritsFrom(TFolder::Class())) {
-      ScanCollection(rec, ((TFolder *) obj)->GetListOfFolders());
+      ScanCollection(rec, ((TFolder *)obj)->GetListOfFolders());
    } else if (obj->InheritsFrom(TDirectory::Class())) {
-      TDirectory *dir = (TDirectory *) obj;
+      TDirectory *dir = (TDirectory *)obj;
       ScanCollection(rec, dir->GetList(), 0, dir->GetListOfKeys());
    } else if (obj->InheritsFrom(TTree::Class())) {
       if (!rec.IsReadOnly(fReadOnly)) {
          rec.SetField("_player", "JSROOT.drawTreePlayer");
          rec.SetField("_prereq", "jq2d");
       }
-      ScanCollection(rec, ((TTree *) obj)->GetListOfLeaves());
+      ScanCollection(rec, ((TTree *)obj)->GetListOfLeaves());
    } else if (obj->InheritsFrom(TBranch::Class())) {
-      ScanCollection(rec, ((TBranch *) obj)->GetListOfLeaves());
+      ScanCollection(rec, ((TBranch *)obj)->GetListOfLeaves());
    } else if (rec.CanExpandItem()) {
-      ScanObjectMembers(rec, obj->IsA(), (char *) obj);
+      ScanObjectMembers(rec, obj->IsA(), (char *)obj);
    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 /// scan collection content
 
-void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
-                                  const char *foldername, TCollection *keys_lst)
+void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst, const char *foldername,
+                                  TCollection *keys_lst)
 {
    if (((lst == 0) || (lst->GetSize() == 0)) && ((keys_lst == 0) || (keys_lst->GetSize() == 0))) return;
 
@@ -763,7 +741,7 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
       TObject *next = iter();
       Bool_t isany = kFALSE;
 
-      while (next!=0) {
+      while (next != 0) {
          if (IsItemField(next)) {
             // special case - in the beginning one could have items for master folder
             if (!isany && (next->GetName() != 0) && ((*(next->GetName()) == '_') || master.ScanOnlyFields()))
@@ -773,10 +751,13 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
          }
 
          isany = kTRUE;
-         TObject* obj = next;
+         TObject *obj = next;
 
          TRootSnifferScanRec chld;
-         if (!chld.GoInside(master, obj, 0, this)) { next = iter(); continue; }
+         if (!chld.GoInside(master, obj, 0, this)) {
+            next = iter();
+            continue;
+         }
 
          if (chld.SetResult(obj, obj->IsA())) return;
 
@@ -789,13 +770,13 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
             if ((next->GetName() != 0) && ((*(next->GetName()) == '_') || chld.ScanOnlyFields())) {
                // only fields starting with _ are stored
                chld.SetField(next->GetName(), next->GetTitle());
-               if (strcmp(next->GetName(), item_prop_kind)==0) has_kind = kTRUE;
-               if (strcmp(next->GetName(), item_prop_title)==0) has_title = kTRUE;
+               if (strcmp(next->GetName(), item_prop_kind) == 0) has_kind = kTRUE;
+               if (strcmp(next->GetName(), item_prop_title) == 0) has_title = kTRUE;
             }
          }
 
          if (!has_kind) chld.SetRootClass(obj->IsA());
-         if (!has_title && (obj->GetTitle()!=0)) chld.SetField(item_prop_title, obj->GetTitle());
+         if (!has_title && (obj->GetTitle() != 0)) chld.SetField(item_prop_title, obj->GetTitle());
 
          ScanObjectChilds(chld, obj);
 
@@ -813,14 +794,17 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
          TObject *obj = (lst == 0) ? 0 : lst->FindObject(key->GetName());
 
          // even object with the name exists, it should also match with class name
-         if ((obj!=0) && (strcmp(obj->ClassName(),key->GetClassName())!=0)) obj = 0;
+         if ((obj != 0) && (strcmp(obj->ClassName(), key->GetClassName()) != 0)) obj = 0;
 
          // if object of that name and of that class already in the list, ignore appropriate key
          if ((obj != 0) && (master.fMask & TRootSnifferScanRec::kScan)) continue;
 
          Bool_t iskey = kFALSE;
          // if object not exists, provide key itself for the scan
-         if (obj == 0) { obj = key; iskey = kTRUE; }
+         if (obj == 0) {
+            obj = key;
+            iskey = kTRUE;
+         }
 
          TRootSnifferScanRec chld;
          TString fullname = TString::Format("%s;%d", key->GetName(), key->GetCycle());
@@ -839,7 +823,7 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
 
             ScanObjectProperties(chld, obj);
 
-            if (obj->GetTitle()!=0) chld.SetField(item_prop_title, obj->GetTitle());
+            if (obj->GetTitle() != 0) chld.SetField(item_prop_title, obj->GetTitle());
 
             // special handling of TKey class - in non-readonly mode
             // sniffer allowed to fetch objects
@@ -893,8 +877,7 @@ void TRootSniffer::ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
 void TRootSniffer::ScanRoot(TRootSnifferScanRec &rec)
 {
    rec.SetField(item_prop_kind, "ROOT.Session");
-   if (fCurrentArg && fCurrentArg->GetUserName())
-      rec.SetField(item_prop_user, fCurrentArg->GetUserName());
+   if (fCurrentArg && fCurrentArg->GetUserName()) rec.SetField(item_prop_user, fCurrentArg->GetUserName());
 
    // should be on the top while //root/http folder could have properties for itself
    TFolder *topf = dynamic_cast(gROOT->FindObject("//root/http"));
@@ -938,13 +921,12 @@ Bool_t TRootSniffer::IsDrawableClass(TClass *cl)
 ////////////////////////////////////////////////////////////////////////////////
 /// scan ROOT hierarchy with provided store object
 
-void TRootSniffer::ScanHierarchy(const char *topname, const char *path,
-                                 TRootSnifferStore *store, Bool_t only_fields)
+void TRootSniffer::ScanHierarchy(const char *topname, const char *path, TRootSnifferStore *store, Bool_t only_fields)
 {
    TRootSnifferScanRec rec;
    rec.fSearchPath = path;
    if (rec.fSearchPath) {
-      while(*rec.fSearchPath == '/') rec.fSearchPath++;
+      while (*rec.fSearchPath == '/') rec.fSearchPath++;
       if (*rec.fSearchPath == 0) rec.fSearchPath = 0;
    }
 
@@ -956,11 +938,9 @@ void TRootSniffer::ScanHierarchy(const char *topname, const char *path,
 
    rec.CreateNode(topname);
 
-   if (rec.fSearchPath == 0)
-      rec.SetField(item_prop_rootversion, TString::Format("%d",ROOT_VERSION_CODE));
+   if (rec.fSearchPath == 0) rec.SetField(item_prop_rootversion, TString::Format("%d", ROOT_VERSION_CODE));
 
-   if ((rec.fSearchPath == 0) && (GetAutoLoad() != 0))
-      rec.SetField(item_prop_autoload, GetAutoLoad());
+   if ((rec.fSearchPath == 0) && (GetAutoLoad() != 0)) rec.SetField(item_prop_autoload, GetAutoLoad());
 
    ScanRoot(rec);
 
@@ -975,8 +955,7 @@ void TRootSniffer::ScanHierarchy(const char *topname, const char *path,
 /// but also number of childs are counted. When member!=0, any object
 /// will be scanned for its data members (disregard of extra options)
 
-void *TRootSniffer::FindInHierarchy(const char *path, TClass **cl,
-                                    TDataMember **member, Int_t *chld)
+void *TRootSniffer::FindInHierarchy(const char *path, TClass **cl, TDataMember **member, Int_t *chld)
 {
    if (IsStreamerInfoItem(path)) {
       // special handling for streamer info
@@ -999,13 +978,12 @@ void *TRootSniffer::FindInHierarchy(const char *path, TClass **cl,
    TClass *res_cl = store.GetResClass();
    void *res = store.GetResPtr();
 
-   if ((res_member!=0) && (res_cl!=0) && (member==0)) {
-      res_cl = (res_member->IsBasic() || res_member->IsSTLContainer()) ? 0 :
-                gROOT->GetClass(res_member->GetTypeName());
+   if ((res_member != 0) && (res_cl != 0) && (member == 0)) {
+      res_cl = (res_member->IsBasic() || res_member->IsSTLContainer()) ? 0 : gROOT->GetClass(res_member->GetTypeName());
       TRealData *rdata = res_cl->GetRealData(res_member->GetName());
       if (rdata) {
-         res = (char *) res + rdata->GetThisOffset();
-         if (res_member->IsaPointer()) res = *((char **) res);
+         res = (char *)res + rdata->GetThisOffset();
+         if (res_member->IsaPointer()) res = *((char **)res);
       } else {
          res = 0; // should never happen
       }
@@ -1030,7 +1008,7 @@ TObject *TRootSniffer::FindTObjectInHierarchy(const char *path)
 
    void *obj = FindInHierarchy(path, &cl);
 
-   return (cl != 0) && (cl->GetBaseClassOffset(TObject::Class()) == 0) ? (TObject *) obj : 0;
+   return (cl != 0) && (cl->GetBaseClassOffset(TObject::Class()) == 0) ? (TObject *)obj : 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1130,8 +1108,7 @@ void TRootSniffer::CreateMemFile()
 /// produce JSON data for specified item
 /// For object conversion TBufferJSON is used
 
-Bool_t TRootSniffer::ProduceJson(const char *path, const char *options,
-                                 TString &res)
+Bool_t TRootSniffer::ProduceJson(const char *path, const char *options, TString &res)
 {
    if ((path == 0) || (*path == 0)) return kFALSE;
 
@@ -1141,8 +1118,7 @@ Bool_t TRootSniffer::ProduceJson(const char *path, const char *options,
    url.SetOptions(options);
    url.ParseOptions();
    Int_t compact = -1;
-   if (url.GetValueFromOptions("compact"))
-      compact = url.GetIntValueFromOptions("compact");
+   if (url.GetValueFromOptions("compact")) compact = url.GetIntValueFromOptions("compact");
 
    TClass *obj_cl(0);
    TDataMember *member(0);
@@ -1157,8 +1133,7 @@ Bool_t TRootSniffer::ProduceJson(const char *path, const char *options,
 ////////////////////////////////////////////////////////////////////////////////
 /// execute command marked as _kind=='Command'
 
-Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options,
-                                TString &res)
+Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options, TString &res)
 {
    TFolder *parent(0);
    TObject *obj = GetItem(path, parent, kFALSE, kFALSE);
@@ -1171,16 +1146,16 @@ Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options,
    }
 
    const char *cmethod = GetItemField(parent, obj, "method");
-   if ((cmethod==0) || (strlen(cmethod)==0)) {
+   if ((cmethod == 0) || (strlen(cmethod) == 0)) {
       if (gDebug > 0) Info("ExecuteCmd", "Entry %s do not defines method for execution", path);
       res = "false";
       return kTRUE;
    }
 
    // if read-only specified for the command, it is not allowed for execution
-   if (fRestrictions.GetLast()>=0) {
+   if (fRestrictions.GetLast() >= 0) {
       FindInHierarchy(path); // one need to call method to check access rights
-      if (fCurrentRestrict==1) {
+      if (fCurrentRestrict == 1) {
          if (gDebug > 0) Info("ExecuteCmd", "Entry %s not allowed for specified user", path);
          res = "false";
          return kTRUE;
@@ -1196,11 +1171,13 @@ Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options,
       url.SetOptions(options);
       url.ParseOptions();
 
-      for (Int_t n=0; n 0) Info("ExecuteCmd", "For command %s argument %s not specified in options %s", path, argname.Data(), options);
+      for (Int_t n = 0; n < numargs; n++) {
+         TString argname = TString::Format("arg%d", n + 1);
+         const char *argvalue = url.GetValueFromOptions(argname);
+         if (argvalue == 0) {
+            if (gDebug > 0)
+               Info("ExecuteCmd", "For command %s argument %s not specified in options %s", path, argname.Data(),
+                    options);
             res = "false";
             return kTRUE;
          }
@@ -1220,13 +1197,13 @@ Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options,
       // if command name started with this-> means method of sniffer will be executed
       item_obj = this;
       separ = 3;
-   } else
-   if (separ != kNPOS) {
+   } else if (separ != kNPOS) {
       item_obj = FindTObjectInHierarchy(TString(method.Data(), separ).Data());
    }
 
    if (item_obj != 0) {
-      method = TString::Format("((%s*)%lu)->%s", item_obj->ClassName(), (long unsigned) item_obj, method.Data() + separ + 3);
+      method =
+         TString::Format("((%s*)%lu)->%s", item_obj->ClassName(), (long unsigned)item_obj, method.Data() + separ + 3);
       if (gDebug > 2) Info("ExecuteCmd", "Executing %s", method.Data());
    }
 
@@ -1244,22 +1221,20 @@ Bool_t TRootSniffer::ExecuteCmd(const char *path, const char *options,
 Bool_t TRootSniffer::ProduceItem(const char *path, const char *options, TString &res, Bool_t asjson)
 {
    if (asjson) {
-      TRootSnifferStoreJson store(res, strstr(options, "compact")!=0);
+      TRootSnifferStoreJson store(res, strstr(options, "compact") != 0);
       ScanHierarchy("top", path, &store, kTRUE);
    } else {
-      TRootSnifferStoreXml store(res, strstr(options, "compact")!=0);
+      TRootSnifferStoreXml store(res, strstr(options, "compact") != 0);
       ScanHierarchy("top", path, &store, kTRUE);
    }
    return res.Length() > 0;
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// produce XML data for specified item
 /// For object conversion TBufferXML is used
 
-Bool_t TRootSniffer::ProduceXml(const char *path, const char * /*options*/,
-                                TString &res)
+Bool_t TRootSniffer::ProduceXml(const char *path, const char * /*options*/, TString &res)
 {
    if ((path == 0) || (*path == 0)) return kFALSE;
 
@@ -1292,8 +1267,8 @@ TString TRootSniffer::DecodeUrlOptionValue(const char *value, Bool_t remove_quot
    res.ReplaceAll("%5D", "]");
    res.ReplaceAll("%3D", "=");
 
-   if (remove_quotes && (res.Length() > 1) &&
-         ((res[0] == '\'') || (res[0] == '\"')) && (res[0] == res[res.Length() - 1])) {
+   if (remove_quotes && (res.Length() > 1) && ((res[0] == '\'') || (res[0] == '\"')) &&
+       (res[0] == res[res.Length() - 1])) {
       res.Remove(res.Length() - 1);
       res.Remove(0, 1);
    }
@@ -1307,7 +1282,8 @@ TString TRootSniffer::DecodeUrlOptionValue(const char *value, Bool_t remove_quot
 /// sniffer should be not-readonly to allow execution of the commands
 /// reskind defines kind of result 0 - debug, 1 - json, 2 - binary
 
-Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t reskind, TString *res_str, void **res_ptr, Long_t *res_length)
+Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t reskind, TString *res_str, void **res_ptr,
+                                Long_t *res_length)
 {
    TString *debug = (reskind == 0) ? res_str : 0;
 
@@ -1336,7 +1312,9 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
          if (debug) debug->Append(TString::Format("Search for any method with name \'%s\'\n", method_name));
          method = obj_cl->GetMethodAllAny(method_name);
       } else {
-         if (debug) debug->Append(TString::Format("Search for method \'%s\' with prototype \'%s\'\n", method_name, prototype.Data()));
+         if (debug)
+            debug->Append(
+               TString::Format("Search for method \'%s\' with prototype \'%s\'\n", method_name, prototype.Data()));
          method = obj_cl->GetMethodWithPrototype(method_name, prototype);
       }
    }
@@ -1349,7 +1327,9 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
             if (debug) debug->Append(TString::Format("Search for any function with name \'%s\'\n", funcname.Data()));
             func = gROOT->GetGlobalFunction(funcname);
          } else {
-            if (debug) debug->Append(TString::Format("Search for function \'%s\' with prototype \'%s\'\n", funcname.Data(), prototype.Data()));
+            if (debug)
+               debug->Append(TString::Format("Search for function \'%s\' with prototype \'%s\'\n", funcname.Data(),
+                                             prototype.Data()));
             func = gROOT->GetGlobalFunctionWithPrototype(funcname, prototype);
          }
       }
@@ -1359,17 +1339,16 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
       }
    }
 
-   if ((method == 0) && (func==0)) {
+   if ((method == 0) && (func == 0)) {
       if (debug) debug->Append("Method not found\n");
       return debug != 0;
    }
 
    if ((fReadOnly && (fCurrentRestrict == 0)) || (fCurrentRestrict == 1)) {
-      if ((method!=0) && (fCurrentAllowedMethods.Index(method_name) == kNPOS)) {
+      if ((method != 0) && (fCurrentAllowedMethods.Index(method_name) == kNPOS)) {
          if (debug) debug->Append("Server runs in read-only mode, method cannot be executed\n");
          return debug != 0;
-      } else
-      if ((func!=0) && (fCurrentAllowedMethods.Index(funcname) == kNPOS)) {
+      } else if ((func != 0) && (fCurrentAllowedMethods.Index(funcname) == kNPOS)) {
          if (debug) debug->Append("Server runs in read-only mode, function cannot be executed\n");
          return debug != 0;
       } else {
@@ -1381,15 +1360,15 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
 
    TList garbage;
    garbage.SetOwner(kTRUE); // use as garbage collection
-   TObject *post_obj = 0; // object reconstructed from post request
+   TObject *post_obj = 0;   // object reconstructed from post request
    TString call_args;
 
    TIter next(args);
    TMethodArg *arg = 0;
-   while ((arg = (TMethodArg *) next()) != 0) {
+   while ((arg = (TMethodArg *)next()) != 0) {
 
-      if ((strcmp(arg->GetName(), "rest_url_opt") == 0) &&
-            (strcmp(arg->GetFullTypeName(), "const char*") == 0) && (args->GetSize() == 1)) {
+      if ((strcmp(arg->GetName(), "rest_url_opt") == 0) && (strcmp(arg->GetFullTypeName(), "const char*") == 0) &&
+          (args->GetSize() == 1)) {
          // very special case - function requires list of options after method=argument
 
          const char *pos = strstr(options, "method=");
@@ -1405,55 +1384,54 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
          val = sval.Data();
       }
 
-      if ((val!=0) && (strcmp(val,"_this_")==0)) {
+      if ((val != 0) && (strcmp(val, "_this_") == 0)) {
          // special case - object itself is used as argument
-         sval.Form("(%s*)0x%lx", obj_cl->GetName(), (long unsigned) obj_ptr);
+         sval.Form("(%s*)0x%lx", obj_cl->GetName(), (long unsigned)obj_ptr);
          val = sval.Data();
-      } else
-      if ((val!=0) && (fCurrentArg!=0) && (fCurrentArg->GetPostData()!=0)) {
+      } else if ((val != 0) && (fCurrentArg != 0) && (fCurrentArg->GetPostData() != 0)) {
          // process several arguments which are specific for post requests
-         if (strcmp(val,"_post_object_xml_")==0) {
+         if (strcmp(val, "_post_object_xml_") == 0) {
             // post data has extra 0 at the end and can be used as null-terminated string
-            post_obj = TBufferXML::ConvertFromXML((const char*) fCurrentArg->GetPostData());
+            post_obj = TBufferXML::ConvertFromXML((const char *)fCurrentArg->GetPostData());
             if (post_obj == 0) {
                sval = "0";
             } else {
-               sval.Form("(%s*)0x%lx", post_obj->ClassName(), (long unsigned) post_obj);
+               sval.Form("(%s*)0x%lx", post_obj->ClassName(), (long unsigned)post_obj);
                if (url.HasOption("_destroy_post_")) garbage.Add(post_obj);
             }
             val = sval.Data();
-         } else
-         if ((strcmp(val,"_post_object_")==0) && url.HasOption("_post_class_")) {
+         } else if ((strcmp(val, "_post_object_") == 0) && url.HasOption("_post_class_")) {
             TString clname = url.GetValueFromOptions("_post_class_");
-            TClass* arg_cl = gROOT->GetClass(clname, kTRUE, kTRUE);
-            if ((arg_cl!=0) && (arg_cl->GetBaseClassOffset(TObject::Class()) == 0) && (post_obj==0)) {
-               post_obj = (TObject*) arg_cl->New();
-               if (post_obj==0) {
+            TClass *arg_cl = gROOT->GetClass(clname, kTRUE, kTRUE);
+            if ((arg_cl != 0) && (arg_cl->GetBaseClassOffset(TObject::Class()) == 0) && (post_obj == 0)) {
+               post_obj = (TObject *)arg_cl->New();
+               if (post_obj == 0) {
                   if (debug) debug->Append(TString::Format("Fail to create object of class %s\n", clname.Data()));
                } else {
-                  if (debug) debug->Append(TString::Format("Reconstruct object of class %s from POST data\n", clname.Data()));
+                  if (debug)
+                     debug->Append(TString::Format("Reconstruct object of class %s from POST data\n", clname.Data()));
                   TBufferFile buf(TBuffer::kRead, fCurrentArg->GetPostDataLength(), fCurrentArg->GetPostData(), kFALSE);
                   buf.MapObject(post_obj, arg_cl);
                   post_obj->Streamer(buf);
                   if (url.HasOption("_destroy_post_")) garbage.Add(post_obj);
                }
             }
-            sval.Form("(%s*)0x%lx", clname.Data(), (long unsigned) post_obj);
+            sval.Form("(%s*)0x%lx", clname.Data(), (long unsigned)post_obj);
             val = sval.Data();
-         } else
-         if (strcmp(val,"_post_data_")==0) {
-            sval.Form("(void*)0x%lx", (long unsigned) *res_ptr);
+         } else if (strcmp(val, "_post_data_") == 0) {
+            sval.Form("(void*)0x%lx", (long unsigned)*res_ptr);
             val = sval.Data();
-         } else
-         if (strcmp(val,"_post_length_")==0) {
-            sval.Form("%ld", (long) *res_length);
+         } else if (strcmp(val, "_post_length_") == 0) {
+            sval.Form("%ld", (long)*res_length);
             val = sval.Data();
          }
       }
 
       if (val == 0) val = arg->GetDefault();
 
-      if (debug) debug->Append(TString::Format("  Argument:%s Type:%s Value:%s \n", arg->GetName(), arg->GetFullTypeName(), val ? val : ""));
+      if (debug)
+         debug->Append(TString::Format("  Argument:%s Type:%s Value:%s \n", arg->GetName(), arg->GetFullTypeName(),
+                                       val ? val : ""));
       if (val == 0) return debug != 0;
 
       if (call_args.Length() > 0) call_args += ", ";
@@ -1471,7 +1449,7 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
 
    TMethodCall *call = 0;
 
-   if (method!=0) {
+   if (method != 0) {
       call = new TMethodCall(obj_cl, method_name, call_args.Data());
       if (debug) debug->Append(TString::Format("Calling obj->%s(%s);\n", method_name, call_args.Data()));
 
@@ -1488,81 +1466,86 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
    }
 
    Int_t compact = 0;
-   if (url.GetValueFromOptions("compact"))
-      compact = url.GetIntValueFromOptions("compact");
+   if (url.GetValueFromOptions("compact")) compact = url.GetIntValueFromOptions("compact");
 
    TString res = "null";
    void *ret_obj = 0;
    TClass *ret_cl = 0;
    TBufferFile *resbuf = 0;
-   if (reskind==2) {
+   if (reskind == 2) {
       resbuf = new TBufferFile(TBuffer::kWrite, 10000);
       garbage.Add(resbuf);
    }
 
    switch (call->ReturnType()) {
-      case TMethodCall::kLong: {
-            Long_t l(0);
-            if (method)
-               call->Execute(obj_ptr, l);
-            else
-               call->Execute(l);
-            if (resbuf) resbuf->WriteLong(l);
-                   else res.Form("%ld", l);
-            break;
-         }
-      case TMethodCall::kDouble : {
-            Double_t d(0.);
-            if (method)
-               call->Execute(obj_ptr, d);
-            else
-               call->Execute(d);
-            if (resbuf) resbuf->WriteDouble(d);
-                   else res.Form(TBufferJSON::GetFloatFormat(), d);
-            break;
-         }
-      case TMethodCall::kString : {
-            char *txt(0);
-            if (method)
-               call->Execute(obj_ptr, &txt);
-            else
-               call->Execute(0, &txt); // here 0 is artificial, there is no proper signature
-            if (txt != 0) {
-               if (resbuf) resbuf->WriteString(txt);
-                      else res.Form("\"%s\"", txt);
-            }
-            break;
-         }
-      case TMethodCall::kOther : {
-            std::string ret_kind = func ? func->GetReturnTypeNormalizedName() : method->GetReturnTypeNormalizedName();
-            if ((ret_kind.length() > 0) && (ret_kind[ret_kind.length() - 1] == '*')) {
-               ret_kind.resize(ret_kind.length() - 1);
-               ret_cl = gROOT->GetClass(ret_kind.c_str(), kTRUE, kTRUE);
-            }
+   case TMethodCall::kLong: {
+      Long_t l(0);
+      if (method)
+         call->Execute(obj_ptr, l);
+      else
+         call->Execute(l);
+      if (resbuf)
+         resbuf->WriteLong(l);
+      else
+         res.Form("%ld", l);
+      break;
+   }
+   case TMethodCall::kDouble: {
+      Double_t d(0.);
+      if (method)
+         call->Execute(obj_ptr, d);
+      else
+         call->Execute(d);
+      if (resbuf)
+         resbuf->WriteDouble(d);
+      else
+         res.Form(TBufferJSON::GetFloatFormat(), d);
+      break;
+   }
+   case TMethodCall::kString: {
+      char *txt(0);
+      if (method)
+         call->Execute(obj_ptr, &txt);
+      else
+         call->Execute(0, &txt); // here 0 is artificial, there is no proper signature
+      if (txt != 0) {
+         if (resbuf)
+            resbuf->WriteString(txt);
+         else
+            res.Form("\"%s\"", txt);
+      }
+      break;
+   }
+   case TMethodCall::kOther: {
+      std::string ret_kind = func ? func->GetReturnTypeNormalizedName() : method->GetReturnTypeNormalizedName();
+      if ((ret_kind.length() > 0) && (ret_kind[ret_kind.length() - 1] == '*')) {
+         ret_kind.resize(ret_kind.length() - 1);
+         ret_cl = gROOT->GetClass(ret_kind.c_str(), kTRUE, kTRUE);
+      }
 
-            if (ret_cl != 0) {
-               Long_t l(0);
-               if (method)
-                  call->Execute(obj_ptr, l);
-               else
-                  call->Execute(l);
-               if (l != 0) ret_obj = (void *) l;
-            } else {
-               if (method)
-                  call->Execute(obj_ptr);
-               else
-                  call->Execute();
-            }
+      if (ret_cl != 0) {
+         Long_t l(0);
+         if (method)
+            call->Execute(obj_ptr, l);
+         else
+            call->Execute(l);
+         if (l != 0) ret_obj = (void *)l;
+      } else {
+         if (method)
+            call->Execute(obj_ptr);
+         else
+            call->Execute();
+      }
 
-            break;
-         }
-      case TMethodCall::kNone : {
-            if (method)
-               call->Execute(obj_ptr);
-            else
-               call->Execute();
-            break;
-         }
+      break;
+   }
+   case TMethodCall::kNone: {
+      if (method)
+         call->Execute(obj_ptr);
+      else
+         call->Execute();
+      break;
+   }
    }
 
    const char *_ret_object_ = url.GetValueFromOptions("_ret_object_");
@@ -1581,7 +1564,7 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
 
    if ((ret_obj != 0) && (ret_cl != 0)) {
       if ((resbuf != 0) && (ret_cl->GetBaseClassOffset(TObject::Class()) == 0)) {
-         TObject *obj = (TObject *) ret_obj;
+         TObject *obj = (TObject *)ret_obj;
          resbuf->MapObject(obj);
          obj->Streamer(*resbuf);
          if (fCurrentArg) fCurrentArg->SetExtraHeader("RootClassName", ret_cl->GetName());
@@ -1625,30 +1608,31 @@ Bool_t TRootSniffer::ProduceExe(const char *path, const char *options, Int_t res
 /// In case of JSON request output is array with results for each item
 /// multi.json request do not support binary requests for the items
 
-Bool_t TRootSniffer::ProduceMulti(const char *path, const char *options, void *&ptr, Long_t &length, TString &str, Bool_t asjson)
+Bool_t TRootSniffer::ProduceMulti(const char *path, const char *options, void *&ptr, Long_t &length, TString &str,
+                                  Bool_t asjson)
 {
-   if ((fCurrentArg==0) || (fCurrentArg->GetPostDataLength()<=0) || (fCurrentArg->GetPostData()==0)) return kFALSE;
+   if ((fCurrentArg == 0) || (fCurrentArg->GetPostDataLength() <= 0) || (fCurrentArg->GetPostData() == 0))
+      return kFALSE;
 
-   const char* args = (const char*) fCurrentArg->GetPostData();
-   const char* ends = args + fCurrentArg->GetPostDataLength();
+   const char *args = (const char *)fCurrentArg->GetPostData();
+   const char *ends = args + fCurrentArg->GetPostDataLength();
 
    TUrl url;
    url.SetOptions(options);
 
    Int_t number = 0;
-   if (url.GetValueFromOptions("number"))
-      number = url.GetIntValueFromOptions("number");
+   if (url.GetValueFromOptions("number")) number = url.GetIntValueFromOptions("number");
 
    // binary buffers required only for binary requests, json output can be produced as is
-   std::vector mem;
+   std::vector mem;
    std::vector memlen;
 
    if (asjson) str = "[";
 
-   for (Int_t n=0;n0) str.Append(", ");
-         if (ptr1!=0) { str.Append("\"\""); free(ptr1); } else
-         if (str1.Length()>0) str.Append(str1); else str.Append("null");
+         if (n > 0) str.Append(", ");
+         if (ptr1 != 0) {
+            str.Append("\"\"");
+            free(ptr1);
+         } else if (str1.Length() > 0)
+            str.Append(str1);
+         else
+            str.Append("null");
       } else {
-         if ((str1.Length()>0) && (ptr1==0)) {
+         if ((str1.Length() > 0) && (ptr1 == 0)) {
             len1 = str1.Length();
             ptr1 = malloc(len1);
             memcpy(ptr1, str1.Data(), len1);
@@ -1700,28 +1689,30 @@ Bool_t TRootSniffer::ProduceMulti(const char *path, const char *options, void *&
       str.Append("]");
    } else {
       length = 0;
-      for (unsigned n=0;n> 8;
-         *curr++ = (char) (l & 0xff); l = l >> 8;
-         *curr++ = (char) (l & 0xff); l = l >> 8;
-         *curr++ = (char) (l & 0xff);
-         if ((mem[n]!=0) && (memlen[n]>0)) memcpy(curr, mem[n], memlen[n]);
-         curr+=memlen[n];
+         *curr++ = (char)(l & 0xff);
+         l = l >> 8;
+         *curr++ = (char)(l & 0xff);
+         l = l >> 8;
+         *curr++ = (char)(l & 0xff);
+         l = l >> 8;
+         *curr++ = (char)(l & 0xff);
+         if ((mem[n] != 0) && (memlen[n] > 0)) memcpy(curr, mem[n], memlen[n]);
+         curr += memlen[n];
       }
    }
 
-   for (unsigned n=0;nSetParent(fMemFile);
@@ -1804,9 +1794,7 @@ Bool_t TRootSniffer::ProduceBinary(const char *path, const char * /*query*/, voi
 ///  Return is memory with produced image
 ///  Memory must be released by user with free(ptr) call
 
-Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path,
-                                  const char *options, void *&ptr,
-                                  Long_t &length)
+Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path, const char *options, void *&ptr, Long_t &length)
 {
    ptr = 0;
    length = 0;
@@ -1823,20 +1811,18 @@ Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path,
       return kFALSE;
    }
 
-   TObject *obj = (TObject *) obj_ptr;
+   TObject *obj = (TObject *)obj_ptr;
 
    TImage *img = TImage::Create();
    if (img == 0) return kFALSE;
 
    if (obj->InheritsFrom(TPad::Class())) {
 
-      if (gDebug > 1)
-         Info("TRootSniffer", "Crate IMAGE directly from pad");
-      img->FromPad((TPad *) obj);
+      if (gDebug > 1) Info("TRootSniffer", "Crate IMAGE directly from pad");
+      img->FromPad((TPad *)obj);
    } else if (IsDrawableClass(obj->IsA())) {
 
-      if (gDebug > 1)
-         Info("TRootSniffer", "Crate IMAGE from object %s", obj->GetName());
+      if (gDebug > 1) Info("TRootSniffer", "Crate IMAGE from object %s", obj->GetName());
 
       Int_t width(300), height(200);
       TString drawopt = "";
@@ -1877,7 +1863,7 @@ Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path,
    char *png_buffer(0);
    int size(0);
 
-   im->GetImageBuffer(&png_buffer, &size, (TImage::EImageFileTypes) kind);
+   im->GetImageBuffer(&png_buffer, &size, (TImage::EImageFileTypes)kind);
 
    if ((png_buffer != 0) && (size > 0)) {
       ptr = malloc(size);
@@ -1885,7 +1871,7 @@ Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path,
       memcpy(ptr, png_buffer, length);
    }
 
-   delete [] png_buffer;
+   delete[] png_buffer;
    delete im;
 
    return ptr != 0;
@@ -1908,53 +1894,39 @@ Bool_t TRootSniffer::ProduceImage(Int_t kind, const char *path,
 /// Result returned either as string or binary buffer,
 /// which should be released with free() call
 
-Bool_t TRootSniffer::Produce(const char *path, const char *file,
-                             const char *options, void *&ptr, Long_t &length, TString &str)
+Bool_t TRootSniffer::Produce(const char *path, const char *file, const char *options, void *&ptr, Long_t &length,
+                             TString &str)
 {
    if ((file == 0) || (*file == 0)) return kFALSE;
 
-   if (strcmp(file, "root.bin") == 0)
-      return ProduceBinary(path, options, ptr, length);
+   if (strcmp(file, "root.bin") == 0) return ProduceBinary(path, options, ptr, length);
 
-   if (strcmp(file, "root.png") == 0)
-      return ProduceImage(TImage::kPng, path, options, ptr, length);
+   if (strcmp(file, "root.png") == 0) return ProduceImage(TImage::kPng, path, options, ptr, length);
 
-   if (strcmp(file, "root.jpeg") == 0)
-      return ProduceImage(TImage::kJpeg, path, options, ptr, length);
+   if (strcmp(file, "root.jpeg") == 0) return ProduceImage(TImage::kJpeg, path, options, ptr, length);
 
-   if (strcmp(file, "root.gif") == 0)
-      return ProduceImage(TImage::kGif, path, options, ptr, length);
+   if (strcmp(file, "root.gif") == 0) return ProduceImage(TImage::kGif, path, options, ptr, length);
 
-   if (strcmp(file, "exe.bin") == 0)
-      return ProduceExe(path, options, 2, 0, &ptr, &length);
+   if (strcmp(file, "exe.bin") == 0) return ProduceExe(path, options, 2, 0, &ptr, &length);
 
-   if (strcmp(file, "root.xml") == 0)
-      return ProduceXml(path, options, str);
+   if (strcmp(file, "root.xml") == 0) return ProduceXml(path, options, str);
 
-   if (strcmp(file, "root.json") == 0)
-      return ProduceJson(path, options, str);
+   if (strcmp(file, "root.json") == 0) return ProduceJson(path, options, str);
 
    // used for debugging
-   if (strcmp(file, "exe.txt") == 0)
-      return ProduceExe(path, options, 0, &str);
+   if (strcmp(file, "exe.txt") == 0) return ProduceExe(path, options, 0, &str);
 
-   if (strcmp(file, "exe.json") == 0)
-      return ProduceExe(path, options, 1, &str);
+   if (strcmp(file, "exe.json") == 0) return ProduceExe(path, options, 1, &str);
 
-   if (strcmp(file, "cmd.json") == 0)
-      return ExecuteCmd(path, options, str);
+   if (strcmp(file, "cmd.json") == 0) return ExecuteCmd(path, options, str);
 
-   if (strcmp(file, "item.json") == 0)
-      return ProduceItem(path, options, str, kTRUE);
+   if (strcmp(file, "item.json") == 0) return ProduceItem(path, options, str, kTRUE);
 
-   if (strcmp(file, "item.xml") == 0)
-      return ProduceItem(path, options, str, kFALSE);
+   if (strcmp(file, "item.xml") == 0) return ProduceItem(path, options, str, kFALSE);
 
-   if (strcmp(file, "multi.bin") == 0)
-      return ProduceMulti(path, options, ptr, length, str, kFALSE);
+   if (strcmp(file, "multi.bin") == 0) return ProduceMulti(path, options, ptr, length, str, kFALSE);
 
-   if (strcmp(file, "multi.json") == 0)
-      return ProduceMulti(path, options, ptr, length, str, kTRUE);
+   if (strcmp(file, "multi.json") == 0) return ProduceMulti(path, options, ptr, length, str, kTRUE);
 
    return kFALSE;
 }
@@ -1983,26 +1955,25 @@ TObject *TRootSniffer::GetItem(const char *fullname, TFolder *&parent, Bool_t fo
    parent = httpfold;
    TObject *obj = httpfold;
 
-   if (fullname==0) return httpfold;
+   if (fullname == 0) return httpfold;
 
    // when full path started not with slash, "Objects" subfolder is appended
    TString path = fullname;
-   if (within_objects && ((path.Length()==0) || (path[0]!='/')))
-      path = fObjectsPath + "/" + path;
+   if (within_objects && ((path.Length() == 0) || (path[0] != '/'))) path = fObjectsPath + "/" + path;
 
    TString tok;
    Ssiz_t from(0);
 
-   while (path.Tokenize(tok,from,"/")) {
-      if (tok.Length()==0) continue;
+   while (path.Tokenize(tok, from, "/")) {
+      if (tok.Length() == 0) continue;
 
-      TFolder *fold = dynamic_cast (obj);
+      TFolder *fold = dynamic_cast(obj);
       if (fold == 0) return 0;
 
       TIter iter(fold->GetListOfFolders());
       while ((obj = iter()) != 0) {
          if (IsItemField(obj)) continue;
-         if (tok.CompareTo(obj->GetName())==0) break;
+         if (tok.CompareTo(obj->GetName()) == 0) break;
       }
 
       if (obj == 0) {
@@ -2024,7 +1995,7 @@ TFolder *TRootSniffer::GetSubFolder(const char *subfolder, Bool_t force)
 {
    TFolder *parent = 0;
 
-   return dynamic_cast (GetItem(subfolder, parent, force));
+   return dynamic_cast(GetItem(subfolder, parent, force));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -2099,35 +2070,36 @@ Bool_t TRootSniffer::CreateItem(const char *fullname, const char *title)
 /// return true when object is TNamed with kItemField bit set
 /// such objects used to keep field values for item
 
-Bool_t TRootSniffer::IsItemField(TObject* obj) const
+Bool_t TRootSniffer::IsItemField(TObject *obj) const
 {
-   return (obj!=0) && (obj->IsA() == TNamed::Class()) && obj->TestBit(kItemField);
+   return (obj != 0) && (obj->IsA() == TNamed::Class()) && obj->TestBit(kItemField);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 /// set or get field for the child
 /// each field coded as TNamed object, placed after chld in the parent hierarchy
 
-Bool_t TRootSniffer::AccessField(TFolder *parent, TObject *chld,
-                                 const char *name, const char *value, TNamed **only_get)
+Bool_t TRootSniffer::AccessField(TFolder *parent, TObject *chld, const char *name, const char *value, TNamed **only_get)
 {
-   if (parent==0) return kFALSE;
+   if (parent == 0) return kFALSE;
 
-   if (chld==0) {
+   if (chld == 0) {
       Info("SetField", "Should be special case for top folder, support later");
       return kFALSE;
    }
 
    TIter iter(parent->GetListOfFolders());
 
-   TObject* obj = 0;
+   TObject *obj = 0;
    Bool_t find(kFALSE), last_find(kFALSE);
    // this is special case of top folder - fields are on very top
-   if (parent == chld) { last_find = find = kTRUE; }
-   TNamed* curr = 0;
+   if (parent == chld) {
+      last_find = find = kTRUE;
+   }
+   TNamed *curr = 0;
    while ((obj = iter()) != 0) {
       if (IsItemField(obj)) {
-         if (last_find && (obj->GetName()!=0) && !strcmp(name, obj->GetName())) curr = (TNamed*) obj;
+         if (last_find && (obj->GetName() != 0) && !strcmp(name, obj->GetName())) curr = (TNamed *)obj;
       } else {
          last_find = (obj == chld);
          if (last_find) find = kTRUE;
@@ -2138,14 +2110,18 @@ Bool_t TRootSniffer::AccessField(TFolder *parent, TObject *chld,
    // object must be in childs list
    if (!find) return kFALSE;
 
-   if (only_get!=0) {
+   if (only_get != 0) {
       *only_get = curr;
-      return curr!=0;
+      return curr != 0;
    }
 
-   if (curr!=0) {
-      if (value!=0) { curr->SetTitle(value); }
-               else { parent->Remove(curr); delete curr; }
+   if (curr != 0) {
+      if (value != 0) {
+         curr->SetTitle(value);
+      } else {
+         parent->Remove(curr);
+         delete curr;
+      }
       return kTRUE;
    }
 
@@ -2159,13 +2135,13 @@ Bool_t TRootSniffer::AccessField(TFolder *parent, TObject *chld,
    }
 
    // only here we do dynamic cast to the TList to use AddAfter
-   TList *lst = dynamic_cast (parent->GetListOfFolders());
-   if (lst==0) {
+   TList *lst = dynamic_cast(parent->GetListOfFolders());
+   if (lst == 0) {
       Error("SetField", "Fail cast to TList");
       return kFALSE;
    }
 
-   if (parent==chld)
+   if (parent == chld)
       lst->AddFirst(curr);
    else
       lst->AddAfter(chld, curr);
@@ -2178,16 +2154,19 @@ Bool_t TRootSniffer::AccessField(TFolder *parent, TObject *chld,
 
 Bool_t TRootSniffer::SetItemField(const char *fullname, const char *name, const char *value)
 {
-   if ((fullname==0) || (name==0)) return kFALSE;
+   if ((fullname == 0) || (name == 0)) return kFALSE;
 
    TFolder *parent(0);
    TObject *obj = GetItem(fullname, parent);
 
-   if ((parent==0) || (obj==0)) return kFALSE;
+   if ((parent == 0) || (obj == 0)) return kFALSE;
 
-   if (strcmp(name, item_prop_title)==0) {
-      TNamed* n = dynamic_cast (obj);
-      if (n!=0) { n->SetTitle(value); return kTRUE; }
+   if (strcmp(name, item_prop_title) == 0) {
+      TNamed *n = dynamic_cast(obj);
+      if (n != 0) {
+         n->SetTitle(value);
+         return kTRUE;
+      }
    }
 
    return AccessField(parent, obj, name, value);
@@ -2198,7 +2177,7 @@ Bool_t TRootSniffer::SetItemField(const char *fullname, const char *name, const
 
 const char *TRootSniffer::GetItemField(TFolder *parent, TObject *obj, const char *name)
 {
-   if ((parent==0) || (obj==0) || (name==0)) return 0;
+   if ((parent == 0) || (obj == 0) || (name == 0)) return 0;
 
    TNamed *field(0);
 
@@ -2207,13 +2186,12 @@ const char *TRootSniffer::GetItemField(TFolder *parent, TObject *obj, const char
    return field ? field->GetTitle() : 0;
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// return field for specified item
 
 const char *TRootSniffer::GetItemField(const char *fullname, const char *name)
 {
-   if (fullname==0) return 0;
+   if (fullname == 0) return 0;
 
    TFolder *parent(0);
    TObject *obj = GetItem(fullname, parent);
@@ -2221,7 +2199,6 @@ const char *TRootSniffer::GetItemField(const char *fullname, const char *name)
    return GetItemField(parent, obj, name);
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 /// Register command which can be executed from web interface
 ///
@@ -2264,12 +2241,11 @@ Bool_t TRootSniffer::RegisterCommand(const char *cmdname, const char *method, co
    SetItemField(cmdname, "method", method);
    Int_t numargs = 0;
    do {
-      TString nextname = TString::Format("%sarg%d%s","%",numargs+1,"%");
-      if (strstr(method,nextname.Data())==0) break;
+      TString nextname = TString::Format("%sarg%d%s", "%", numargs + 1, "%");
+      if (strstr(method, nextname.Data()) == 0) break;
       numargs++;
-   } while (numargs<100);
-   if (numargs>0)
-      SetItemField(cmdname, "_numargs", TString::Format("%d", numargs));
+   } while (numargs < 100);
+   if (numargs > 0) SetItemField(cmdname, "_numargs", TString::Format("%d", numargs));
 
    return kTRUE;
 }
diff --git a/net/http/src/TRootSnifferStore.cxx b/net/http/src/TRootSnifferStore.cxx
index 03aa80ee760b6..0f19d655bb73e 100644
--- a/net/http/src/TRootSnifferStore.cxx
+++ b/net/http/src/TRootSnifferStore.cxx
@@ -1,3 +1,14 @@
+// $Id$
+// Author: Sergey Linev   22/12/2013
+
+/*************************************************************************
+ * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
 #include "TRootSnifferStore.h"
 
 //////////////////////////////////////////////////////////////////////////
@@ -10,16 +21,11 @@
 
 ClassImp(TRootSnifferStore)
 
-////////////////////////////////////////////////////////////////////////////////
-/// normal constructor
-
-TRootSnifferStore::TRootSnifferStore() :
-   TObject(),
-   fResPtr(0),
-   fResClass(0),
-   fResMember(0),
-   fResNumChilds(-1),
-   fResRestrict(0)
+   ////////////////////////////////////////////////////////////////////////////////
+   /// normal constructor
+
+   TRootSnifferStore::TRootSnifferStore()
+   : TObject(), fResPtr(0), fResClass(0), fResMember(0), fResNumChilds(-1), fResRestrict(0)
 {
 }
 
@@ -33,8 +39,7 @@ TRootSnifferStore::~TRootSnifferStore()
 ////////////////////////////////////////////////////////////////////////////////
 /// set pointer on found element, class and number of childs
 
-void TRootSnifferStore::SetResult(void *_res, TClass *_rescl,
-                                  TDataMember *_resmemb, Int_t _res_chld, Int_t _restr)
+void TRootSnifferStore::SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb, Int_t _res_chld, Int_t _restr)
 {
    fResPtr = _res;
    fResClass = _rescl;
@@ -55,10 +60,10 @@ void TRootSnifferStore::SetResult(void *_res, TClass *_rescl,
 
 ClassImp(TRootSnifferStoreXml)
 
-////////////////////////////////////////////////////////////////////////////////
-/// starts new xml node, will be closed by CloseNode
+   ////////////////////////////////////////////////////////////////////////////////
+   /// starts new xml node, will be closed by CloseNode
 
-void TRootSnifferStoreXml::CreateNode(Int_t lvl, const char *nodename)
+   void TRootSnifferStoreXml::CreateNode(Int_t lvl, const char *nodename)
 {
    fBuf->Append(TString::Format("%*s&\'\"") == 0) {
       fBuf->Append(TString::Format(" %s=\"%s\"", field, value));
@@ -76,24 +80,12 @@ void TRootSnifferStoreXml::SetField(Int_t, const char *field, const char *value,
       const char *v = value;
       while (*v != 0) {
          switch (*v) {
-            case '<' :
-               fBuf->Append("<");
-               break;
-            case '>' :
-               fBuf->Append(">");
-               break;
-            case '&' :
-               fBuf->Append("&");
-               break;
-            case '\'' :
-               fBuf->Append("'");
-               break;
-            case '\"' :
-               fBuf->Append(""");
-               break;
-            default:
-               fBuf->Append(*v);
-               break;
+         case '<': fBuf->Append("<"); break;
+         case '>': fBuf->Append(">"); break;
+         case '&': fBuf->Append("&"); break;
+         case '\'': fBuf->Append("'"); break;
+         case '\"': fBuf->Append("""); break;
+         default: fBuf->Append(*v); break;
          }
          v++;
       }
@@ -134,21 +126,21 @@ void TRootSnifferStoreXml::CloseNode(Int_t lvl, Int_t numchilds)
 
 ClassImp(TRootSnifferStoreJson)
 
-////////////////////////////////////////////////////////////////////////////////
-/// starts new json object, will be closed by CloseNode
+   ////////////////////////////////////////////////////////////////////////////////
+   /// starts new json object, will be closed by CloseNode
 
-void TRootSnifferStoreJson::CreateNode(Int_t lvl, const char *nodename)
+   void TRootSnifferStoreJson::CreateNode(Int_t lvl, const char *nodename)
 {
    fBuf->Append(TString::Format("%*s{", fCompact ? 0 : lvl * 4, ""));
    if (!fCompact) fBuf->Append("\n");
-   fBuf->Append(TString::Format("%*s\"_name\"%s\"%s\"", fCompact ? 0 : lvl * 4 + 2, "", (fCompact ? ":" : " : "), nodename));
+   fBuf->Append(
+      TString::Format("%*s\"_name\"%s\"%s\"", fCompact ? 0 : lvl * 4 + 2, "", (fCompact ? ":" : " : "), nodename));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 /// set field (json field) in current node
 
-void TRootSnifferStoreJson::SetField(Int_t lvl, const char *field,
-                                     const char *value, Bool_t with_quotes)
+void TRootSnifferStoreJson::SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes)
 {
    fBuf->Append(",");
    if (!fCompact) fBuf->Append("\n");
@@ -157,37 +149,20 @@ void TRootSnifferStoreJson::SetField(Int_t lvl, const char *field,
       fBuf->Append(value);
    } else {
       fBuf->Append("\"");
-      for (const char *v = value; *v != 0; v++)
-         switch (*v) {
-            case '\n':
-               fBuf->Append("\\n");
-               break;
-            case '\t':
-               fBuf->Append("\\t");
-               break;
-            case '\"':
-               fBuf->Append("\\\"");
-               break;
-            case '\\':
-               fBuf->Append("\\\\");
-               break;
-            case '\b':
-               fBuf->Append("\\b");
-               break;
-            case '\f':
-               fBuf->Append("\\f");
-               break;
-            case '\r':
-               fBuf->Append("\\r");
-               break;
-            case '/':
-               fBuf->Append("\\/");
-               break;
-            default:
-               if ((*v > 31) && (*v < 127))
-                  fBuf->Append(*v);
-               else
-                  fBuf->Append(TString::Format("\\u%04x", (unsigned) *v));
+      for (const char *v = value; *v != 0; v++) switch (*v) {
+         case '\n': fBuf->Append("\\n"); break;
+         case '\t': fBuf->Append("\\t"); break;
+         case '\"': fBuf->Append("\\\""); break;
+         case '\\': fBuf->Append("\\\\"); break;
+         case '\b': fBuf->Append("\\b"); break;
+         case '\f': fBuf->Append("\\f"); break;
+         case '\r': fBuf->Append("\\r"); break;
+         case '/': fBuf->Append("\\/"); break;
+         default:
+            if ((*v > 31) && (*v < 127))
+               fBuf->Append(*v);
+            else
+               fBuf->Append(TString::Format("\\u%04x", (unsigned)*v));
          }
       fBuf->Append("\"");
    }
@@ -210,8 +185,6 @@ void TRootSnifferStoreJson::BeforeNextChild(Int_t lvl, Int_t nchld, Int_t)
 
 void TRootSnifferStoreJson::CloseNode(Int_t lvl, Int_t numchilds)
 {
-   if (numchilds > 0)
-      fBuf->Append(TString::Format("%s%*s]", (fCompact ? "" : "\n"), fCompact ? 0 : lvl * 4 + 2, ""));
+   if (numchilds > 0) fBuf->Append(TString::Format("%s%*s]", (fCompact ? "" : "\n"), fCompact ? 0 : lvl * 4 + 2, ""));
    fBuf->Append(TString::Format("%s%*s}", (fCompact ? "" : "\n"), fCompact ? 0 : lvl * 4, ""));
 }
-