Allow TOS redirect. Fix upload finished detection when redirecting.
This fixes https://code.google.com/p/singularity-viewer/issues/detail?id=705 Adds 'bool redirect_status_ok(void) const { return true; }' to LLIamHere, because it's ok to receive a 302 status there. Likewise added to LLIamHereVoice, because that has the same comment in its error() method. Also fixes the problem that if two redirects occur on a row, then the upload_finished detection asserted because it would detect the third time that libcurl turned off writing to the socket as a failure (the second time wasn't a problem because mUploadFinished was reset upon receiving the first 302 header, but not upon receiving the second header).
This commit is contained in:
@@ -806,7 +806,15 @@ void CurlSocketInfo::set_action(int action)
|
||||
if ((toggle_action & CURL_POLL_OUT))
|
||||
{
|
||||
if ((action & CURL_POLL_OUT))
|
||||
{
|
||||
mMultiHandle.mWritePollSet->add(this);
|
||||
if (mTimeout)
|
||||
{
|
||||
// Note that this detection normally doesn't work because mTimeout will be zero.
|
||||
// However, it works in the case of a redirect - and then we need it.
|
||||
mTimeout->upload_starting(); // Update timeout administration.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mMultiHandle.mWritePollSet->remove(this);
|
||||
@@ -2140,6 +2148,11 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
|
||||
self_w->received_HTTP_header();
|
||||
self_w->setStatusAndReason(status, reason);
|
||||
done = true;
|
||||
if (status >= 300 && status < 400)
|
||||
{
|
||||
// Timeout administration needs to know if we're being redirected.
|
||||
self_w->httptimeout()->being_redirected();
|
||||
}
|
||||
}
|
||||
// Update timeout administration. This must be done after the status is already known.
|
||||
if (self_w->httptimeout()->data_received(header_len/*,*/ ASSERT_ONLY_COMMA(self_w->upload_error_status())))
|
||||
|
||||
Reference in New Issue
Block a user