Skip to content

Commit

Permalink
Performance optimization by providing the HTTP status text length
Browse files Browse the repository at this point in the history
  • Loading branch information
mpatrascoiu committed Jun 12, 2018
1 parent 6771b3c commit 62a996d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/XrdHttp/XrdHttpReq.cc
Expand Up @@ -1486,12 +1486,12 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
}

prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
reset();
return 1;
} else {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}
}
Expand All @@ -1503,7 +1503,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {

if (xrdresp == kXR_error) {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}

Expand Down Expand Up @@ -1732,7 +1732,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {

if (prot->myRole == kXR_isManager) {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}

Expand Down Expand Up @@ -1823,7 +1823,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
// return 0;
//}
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}

Expand All @@ -1833,7 +1833,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
}
default: //read or readv
{

// Nothing to do if we are postprocessing a close
if (ntohs(xrdreq.header.requestid) == kXR_close) return 1;

Expand Down Expand Up @@ -1961,7 +1961,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
return 1;
} else {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}
}
Expand All @@ -1983,7 +1983,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {

if (xrdresp != kXR_ok) {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}

Expand Down Expand Up @@ -2016,7 +2016,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
return 1;
}
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}
}
Expand All @@ -2029,7 +2029,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {

if (xrdresp == kXR_error) {
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), 0);
httpStatusText.c_str(), httpStatusText.length());
return -1;
}

Expand Down Expand Up @@ -2269,7 +2269,8 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {

switch (xrdresp) {
case kXR_error:
prot->SendSimpleResp(httpStatusCode, NULL, NULL, httpStatusText.c_str(), 0);
prot->SendSimpleResp(httpStatusCode, NULL, NULL,
httpStatusText.c_str(), httpStatusText.length());
return -1;
break;

Expand Down

0 comments on commit 62a996d

Please sign in to comment.