mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
reset
This commit is contained in:
parent
382ab2279b
commit
b12571edd9
@ -275,6 +275,28 @@ get_file_size() const {
|
||||
return _file_size;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::reset
|
||||
// Access: Published
|
||||
// Description: Stops whatever file transaction is currently in
|
||||
// progress, closes the connection, and resets to begin
|
||||
// anew. You shouldn't ever need to call this, since
|
||||
// the channel should be able to reset itself cleanly
|
||||
// between requests, but it is provided in case you are
|
||||
// an especially nervous type.
|
||||
//
|
||||
// Don't call this after every request unless you set
|
||||
// set_persistent_connection() to false, since calling
|
||||
// reset() rudely closes the connection regardless of
|
||||
// whether we have told the server we intend to keep it
|
||||
// open or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void HTTPChannel::
|
||||
reset() {
|
||||
reset_for_new_request();
|
||||
free_bio();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::post_form
|
||||
// Access: Published
|
||||
|
@ -1214,13 +1214,7 @@ run_download_to_ram() {
|
||||
void HTTPChannel::
|
||||
begin_request(const string &method, const URLSpec &url, const string &body,
|
||||
bool nonblocking, size_t first_byte, size_t last_byte) {
|
||||
reset_download_to();
|
||||
_status_code = 0;
|
||||
_status_string = string();
|
||||
_redirect_trail.clear();
|
||||
_last_status_code = 0;
|
||||
_file_size = 0;
|
||||
_bytes_downloaded = 0;
|
||||
reset_for_new_request();
|
||||
|
||||
// Changing the proxy, or the nonblocking state, is grounds for
|
||||
// dropping the old connection, if any.
|
||||
@ -1276,6 +1270,23 @@ begin_request(const string &method, const URLSpec &url, const string &body,
|
||||
_done_state = S_read_header;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::reset_for_new_request
|
||||
// Access: Private
|
||||
// Description: Resets the internal state variables in preparation
|
||||
// for beginning a new request.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HTTPChannel::
|
||||
reset_for_new_request() {
|
||||
reset_download_to();
|
||||
_status_code = 0;
|
||||
_status_string = string();
|
||||
_redirect_trail.clear();
|
||||
_last_status_code = 0;
|
||||
_file_size = 0;
|
||||
_bytes_downloaded = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::http_getline
|
||||
// Access: Private
|
||||
|
@ -99,6 +99,8 @@ PUBLISHED:
|
||||
|
||||
void write_headers(ostream &out) const;
|
||||
|
||||
INLINE void reset();
|
||||
|
||||
INLINE bool post_form(const URLSpec &url, const string &body);
|
||||
INLINE bool get_document(const URLSpec &url);
|
||||
INLINE bool get_subdocument(const URLSpec &url,
|
||||
@ -142,6 +144,7 @@ private:
|
||||
void begin_request(const string &method, const URLSpec &url,
|
||||
const string &body, bool nonblocking,
|
||||
size_t first_byte, size_t last_byte);
|
||||
void reset_for_new_request();
|
||||
|
||||
bool http_getline(string &str);
|
||||
bool http_send(const string &str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user