Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log davs:// https:// transfer stats in the logs #1536

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/XrdHttp/XrdHttpProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
CurrentReq.opaque = 0;
}

TRACEI(REQ, " rc:" << rc << " self-redirecting to http with security token.");
TRACEI(REDIR, " rc:" << rc << " self-redirecting to http with security token.");

XrdOucString dest = "Location: http://";
// Here I should put the IP addr of the server
Expand Down Expand Up @@ -694,7 +694,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
dest += ":";
dest += Port_str;
dest += CurrentReq.resource.c_str();
TRACEI(REQ," rc:"<<rc<<" self-redirecting to http with security token: '"
TRACEI(REDIR," rc:"<<rc<<" self-redirecting to http with security token: '"
<< dest.c_str() << "'");


Expand All @@ -704,7 +704,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
return -1;
}

TRACEI(REQ, " rc:" << rc << " Can't perform self-redirection.");
TRACEI(REDIR, " rc:" << rc << " Can't perform self-redirection.");

}
else {
Expand All @@ -726,11 +726,11 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
char * t = CurrentReq.opaque->Get("xrdhttptime");
if (t) tim = atoi(t);
if (!t) {
TRACEI(REQ, " xrdhttptime not specified. Authentication failed.");
TRACEI(AUTH, " xrdhttptime not specified. Authentication failed.");
return -1;
}
if (abs(time(0) - tim) > XRHTTP_TK_GRACETIME) {
TRACEI(REQ, " Token expired. Authentication failed.");
TRACEI(AUTH, " Token expired. Authentication failed.");
return -1;
}

Expand Down Expand Up @@ -815,7 +815,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
secretkey);

if (compareHash(hash, tk)) {
TRACEI(REQ, " Invalid tk '" << tk << "' != '" << hash << "'(calculated). Authentication failed.");
TRACEI(AUTH, " Invalid tk '" << tk << "' != '" << hash << "'(calculated). Authentication failed.");
return -1;
}

Expand Down Expand Up @@ -850,7 +850,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here
Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, "unknown", ishttps ? "https" : "http");

if (!Bridge) {
TRACEI(REQ, " Authorization failed.");
TRACEI(AUTH, " Authorization failed.");
return -1;
}

Expand Down Expand Up @@ -1786,6 +1786,7 @@ void XrdHttpProtocol::Reset() {
ResumeBytes = 0;
Resume = 0;

rec = LogRecord();
//
// numReads = 0;
// numReadP = 0;
Expand Down Expand Up @@ -2721,6 +2722,8 @@ int XrdHttpProtocol::xtrace(XrdOucStream & Config) {
} tropts[] = {
{"all", TRACE_ALL},
{"auth", TRACE_AUTH},
{"stats", TRACE_STATS},
{"statsall", TRACE_STATSALL},
{"debug", TRACE_DEBUG},
{"mem", TRACE_MEM},
{"redirect", TRACE_REDIR},
Expand All @@ -2733,6 +2736,7 @@ int XrdHttpProtocol::xtrace(XrdOucStream & Config) {
eDest.Emsg("config", "trace option not specified");
return 1;
}
// It does not support inline comments. How come?!
while (val) {
if (!strcmp(val, "off")) trval = 0;
else {
Expand Down
13 changes: 13 additions & 0 deletions src/XrdHttp/XrdHttpProtocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ private:
: extHName(hName), extHPath(hPath), extHParm(hParm) {}
~extHInfo() {}
};

struct LogRecord {
bool paramsSet;
std::string log_prefix;
XrdOucString* filename;
std::string remote;
std::string name;
std::string reqtype;
int reqstate{-1};
int status{-1};
};
LogRecord rec;

/// Functions related to the configuration
static int Config(const char *fn, XrdOucEnv *myEnv);
static const char *Configed();
Expand Down