Skip to content

Commit

Permalink
Send chunked response for errors in a transfer.
Browse files Browse the repository at this point in the history
When an error occurs during a multi-part response, send a chunk-encoded
response and not a complete HTTP response.
  • Loading branch information
bbockelm committed Jun 8, 2018
1 parent 5c1181b commit 57e756b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/XrdTpc/XrdTpcTPC.cc
Expand Up @@ -312,9 +312,12 @@ int TPCHandler::RunCurlWithUpdates(CURL *curl, XrdHttpExtReq &req, State &state,
char msg[] = "Internal server error due to libcurl";
curl_multi_remove_handle(multi_handle, curl);
curl_easy_cleanup(curl);

curl_multi_cleanup(multi_handle);
return req.SendSimpleResp(500, NULL, NULL, msg, 0);

if ((retval = req.ChunkResp(msg, 0))) {
return retval;
}
return req.ChunkResp(NULL, 0);
}

// Harvest any messages, looking for CURLMSG_DONE.
Expand All @@ -336,7 +339,11 @@ int TPCHandler::RunCurlWithUpdates(CURL *curl, XrdHttpExtReq &req, State &state,
curl_multi_cleanup(multi_handle);
char msg[] = "Internal state error in libcurl";
m_log.Emsg(log_prefix, msg);
return req.SendSimpleResp(500, NULL, NULL, msg, 0);

if ((retval = req.ChunkResp(msg, 0))) {
return retval;
}
return req.ChunkResp(NULL, 0);
}
curl_multi_cleanup(multi_handle);

Expand Down

0 comments on commit 57e756b

Please sign in to comment.