mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add preserve_status
This commit is contained in:
parent
12a6dc05ce
commit
ee62734534
@ -510,8 +510,30 @@ INLINE void HTTPChannel::
|
||||
reset() {
|
||||
reset_for_new_request();
|
||||
reset_to_new();
|
||||
_status_list.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::preserve_status
|
||||
// Access: Published
|
||||
// Description: Preserves the previous status code (presumably a
|
||||
// failure) from the previous connection attempt. If
|
||||
// the subsequent connection attempt also fails, the
|
||||
// returned status code will be the better of the
|
||||
// previous code and the current code.
|
||||
//
|
||||
// This can be called to daisy-chain subsequent attempts
|
||||
// to download the same document from different servers.
|
||||
// After all servers have been attempted, the final
|
||||
// status code will reflect the attempt that most nearly
|
||||
// succeeded.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void HTTPChannel::
|
||||
preserve_status() {
|
||||
_status_list.push_back(_status_entry);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::clear_extra_headers
|
||||
// Access: Published
|
||||
|
@ -757,11 +757,16 @@ reached_done_state() {
|
||||
}
|
||||
}
|
||||
_status_entry = _status_list[best_i];
|
||||
_status_list.clear();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (_download_dest == DD_none) {
|
||||
// We don't need the list of previous failures any more--we've connected.
|
||||
_status_list.clear();
|
||||
|
||||
if (_download_dest == DD_none) {
|
||||
// All done.
|
||||
return false;
|
||||
|
||||
@ -806,7 +811,7 @@ run_try_next_proxy() {
|
||||
close_connection();
|
||||
reconsider_proxy();
|
||||
_state = S_connecting;
|
||||
nassertr(_status_list.size() == _proxy_next_index - 1, false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2170,7 +2175,6 @@ reset_for_new_request() {
|
||||
|
||||
_last_status_code = 0;
|
||||
_status_entry = StatusEntry();
|
||||
_status_list.clear();
|
||||
|
||||
_response_type = RT_none;
|
||||
_redirect_trail.clear();
|
||||
|
@ -147,6 +147,7 @@ PUBLISHED:
|
||||
void write_headers(ostream &out) const;
|
||||
|
||||
INLINE void reset();
|
||||
INLINE void preserve_status();
|
||||
|
||||
INLINE void clear_extra_headers();
|
||||
INLINE void send_extra_header(const string &key, const string &value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user