Added X-Attempt header to HEAD and POST requests in Downloader
This commit is contained in:
parent
caffcd9935
commit
9dc9bf64ee
1 changed files with 6 additions and 0 deletions
|
@ -181,6 +181,9 @@ namespace HTTP{
|
||||||
size_t loop = 0;
|
size_t loop = 0;
|
||||||
while (++loop <= retryCount){// loop while we are unsuccessful
|
while (++loop <= retryCount){// loop while we are unsuccessful
|
||||||
MEDIUM_MSG("Retrieving %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), loop, retryCount);
|
MEDIUM_MSG("Retrieving %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), loop, retryCount);
|
||||||
|
char attemptNo[5];
|
||||||
|
snprintf(attemptNo, 5, "%zu", loop);
|
||||||
|
setHeader("X-Attempt", attemptNo);
|
||||||
doRequest(link, "HEAD");
|
doRequest(link, "HEAD");
|
||||||
if (!getSocket()){
|
if (!getSocket()){
|
||||||
FAIL_MSG("Could not retrieve %s: %s", link.getUrl().c_str(), getSocket().getError().c_str());
|
FAIL_MSG("Could not retrieve %s: %s", link.getUrl().c_str(), getSocket().getError().c_str());
|
||||||
|
@ -424,6 +427,9 @@ namespace HTTP{
|
||||||
while (++loop <= retryCount){// loop while we are unsuccessful
|
while (++loop <= retryCount){// loop while we are unsuccessful
|
||||||
MEDIUM_MSG("Posting to %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), loop, retryCount);
|
MEDIUM_MSG("Posting to %s (%zu/%" PRIu32 ")", link.getUrl().c_str(), loop, retryCount);
|
||||||
uint64_t prerequest = Util::getMicros();
|
uint64_t prerequest = Util::getMicros();
|
||||||
|
char attemptNo[5];
|
||||||
|
snprintf(attemptNo, 5, "%zu", loop);
|
||||||
|
setHeader("X-Attempt", attemptNo);
|
||||||
doRequest(link, "POST", 0, payloadLen);
|
doRequest(link, "POST", 0, payloadLen);
|
||||||
Socket::Connection & s = getSocket();
|
Socket::Connection & s = getSocket();
|
||||||
if (payloadLen && payload){
|
if (payloadLen && payload){
|
||||||
|
|
Loading…
Add table
Reference in a new issue