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

Close file handle for simple HTTP reads. #664

Merged
merged 1 commit into from
Mar 16, 2018
Merged
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
15 changes: 14 additions & 1 deletion src/XrdHttp/XrdHttpReq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ int XrdHttpReq::parseRWOp(char *str) {
len_ok += len;
rwOps_split.push_back(nfo);
}
length += len_ok;


}
Expand Down Expand Up @@ -984,7 +985,7 @@ int XrdHttpReq::ProcessHTTPReq() {
{

if ( ((reqstate == 3) && (rwOps.size() > 1)) ||
(writtenbytes >= filesize) ) {
(writtenbytes >= length) ) {

// Close() if this was a readv or we have finished, otherwise read the next chunk

Expand Down Expand Up @@ -1677,6 +1678,12 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
&filesize,
&fileflags,
&filemodtime);

// We will default the response size specified by the headers; if that
// wasn't given, use the file size.
if (!length) {
length = filesize;
}
}
else
TRACEI(REQ, "Can't find the stat information for '" << resource << "' Internal error?");
Expand Down Expand Up @@ -1716,6 +1723,12 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
&filesize,
&fileflags,
&filemodtime);

// As above: if the client specified a response size, we use that.
// Otherwise, utilize the filesize
if (!length) {
length = filesize;
}
}
else
TRACEI(ALL, "GET returned no STAT information. Internal error?");
Expand Down
2 changes: 1 addition & 1 deletion src/XrdHttp/XrdHttpReq.hh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public:
std::vector<ReadWriteOp> rwOps_split;

bool keepalive;
long long length;
long long length; // Total size from client for PUT; total length of response TO client for GET.
int depth;
bool sendcontinue;

Expand Down