21 INLINE HTTPClient *HTTPChannel::
33 INLINE
bool HTTPChannel::
35 return (_state != S_failure && (get_status_code() / 100) == 2 &&
36 (_server_response_has_no_body || !_source.is_null()));
46 INLINE
bool HTTPChannel::
47 is_connection_ready()
const {
48 return (!_source.is_null() && _state == S_ready);
61 INLINE
const URLSpec &HTTPChannel::
63 return _document_spec.
get_url();
80 get_document_spec()
const {
81 return _document_spec;
91 INLINE HTTPEnum::HTTPVersion HTTPChannel::
92 get_http_version()
const {
102 INLINE
const string &HTTPChannel::
103 get_http_version_string()
const {
104 return _http_version_string;
122 INLINE
int HTTPChannel::
123 get_status_code()
const {
124 return _status_entry._status_code;
138 INLINE
const string &HTTPChannel::
139 get_www_realm()
const {
153 INLINE
const string &HTTPChannel::
154 get_proxy_realm()
const {
169 INLINE
const URLSpec &HTTPChannel::
170 get_redirect()
const {
183 INLINE
int HTTPChannel::
184 get_num_redirect_steps()
const {
185 return _redirect_trail.size();
196 INLINE
const URLSpec &HTTPChannel::
197 get_redirect_step(
int n)
const {
198 nassertr(n >= 0 && n < (
int)_redirect_trail.size(), _redirect_trail[0]);
199 return _redirect_trail[n];
217 INLINE
void HTTPChannel::
218 set_persistent_connection(
bool persistent_connection) {
219 _persistent_connection = persistent_connection;
231 INLINE
bool HTTPChannel::
232 get_persistent_connection()
const {
233 return _persistent_connection;
246 INLINE
void HTTPChannel::
247 set_allow_proxy(
bool allow_proxy) {
248 _allow_proxy = allow_proxy;
261 INLINE
bool HTTPChannel::
262 get_allow_proxy()
const {
287 INLINE
void HTTPChannel::
288 set_proxy_tunnel(
bool proxy_tunnel) {
289 _proxy_tunnel = proxy_tunnel;
299 INLINE
bool HTTPChannel::
300 get_proxy_tunnel()
const {
301 return _proxy_tunnel;
316 INLINE
void HTTPChannel::
317 set_connect_timeout(
double connect_timeout) {
318 _connect_timeout = connect_timeout;
328 INLINE
double HTTPChannel::
329 get_connect_timeout()
const {
330 return _connect_timeout;
351 INLINE
void HTTPChannel::
352 set_blocking_connect(
bool blocking_connect) {
353 _blocking_connect = blocking_connect;
366 INLINE
bool HTTPChannel::
367 get_blocking_connect()
const {
368 return _blocking_connect;
387 INLINE
void HTTPChannel::
388 set_http_timeout(
double http_timeout) {
389 _http_timeout = http_timeout;
399 INLINE
double HTTPChannel::
400 get_http_timeout()
const {
401 return _http_timeout;
422 INLINE
void HTTPChannel::
423 set_skip_body_size(
size_t skip_body_size) {
424 _skip_body_size = skip_body_size;
435 INLINE
size_t HTTPChannel::
436 get_skip_body_size()
const {
437 return _skip_body_size;
452 INLINE
void HTTPChannel::
453 set_idle_timeout(
double idle_timeout) {
454 _idle_timeout = idle_timeout;
464 INLINE
double HTTPChannel::
465 get_idle_timeout()
const {
466 return _idle_timeout;
489 INLINE
void HTTPChannel::
490 set_download_throttle(
bool download_throttle) {
491 _download_throttle = download_throttle;
500 INLINE
bool HTTPChannel::
501 get_download_throttle()
const {
502 return _download_throttle;
513 INLINE
void HTTPChannel::
514 set_max_bytes_per_second(
double max_bytes_per_second) {
515 _max_bytes_per_second = max_bytes_per_second;
516 _bytes_per_update = int(_max_bytes_per_second * _seconds_per_update);
526 INLINE
double HTTPChannel::
527 get_max_bytes_per_second()
const {
528 return _max_bytes_per_second;
539 INLINE
void HTTPChannel::
540 set_max_updates_per_second(
double max_updates_per_second) {
541 nassertv(max_updates_per_second != 0.0f);
542 _max_updates_per_second = max_updates_per_second;
543 _seconds_per_update = 1.0f / _max_updates_per_second;
544 _bytes_per_update = int(_max_bytes_per_second * _seconds_per_update);
554 INLINE
double HTTPChannel::
555 get_max_updates_per_second()
const {
556 return _max_updates_per_second;
569 INLINE
void HTTPChannel::
570 set_expected_file_size(
size_t file_size) {
571 _expected_file_size = file_size;
572 _got_expected_file_size =
true;
587 INLINE
bool HTTPChannel::
588 is_file_size_known()
const {
589 return _got_file_size;
602 INLINE
size_t HTTPChannel::
603 get_first_byte_requested()
const {
604 return _first_byte_requested;
617 INLINE
size_t HTTPChannel::
618 get_last_byte_requested()
const {
619 return _last_byte_requested;
634 INLINE
size_t HTTPChannel::
635 get_first_byte_delivered()
const {
636 return _first_byte_delivered;
651 INLINE
size_t HTTPChannel::
652 get_last_byte_delivered()
const {
653 return _last_byte_delivered;
672 INLINE
void HTTPChannel::
674 reset_for_new_request();
676 _status_list.clear();
694 INLINE
void HTTPChannel::
696 _status_list.push_back(_status_entry);
706 INLINE
void HTTPChannel::
707 clear_extra_headers() {
708 _send_extra_headers = string();
723 INLINE
void HTTPChannel::
724 send_extra_header(
const string &key,
const string &value) {
725 _send_extra_headers += key;
726 _send_extra_headers +=
": ";
727 _send_extra_headers += value;
728 _send_extra_headers +=
"\r\n";
737 INLINE
bool HTTPChannel::
739 begin_request(HTTPEnum::M_get, url,
string(),
false, 0, 0);
755 INLINE
bool HTTPChannel::
756 get_subdocument(
const DocumentSpec &url,
size_t first_byte,
size_t last_byte) {
757 begin_request(HTTPEnum::M_get, url,
string(),
false, first_byte, last_byte);
772 INLINE
bool HTTPChannel::
774 begin_request(HTTPEnum::M_head, url,
string(),
false, 0, 0);
786 INLINE
bool HTTPChannel::
787 post_form(
const DocumentSpec &url,
const string &body) {
788 begin_request(HTTPEnum::M_post, url, body,
false, 0, 0);
800 INLINE
bool HTTPChannel::
801 put_document(
const DocumentSpec &url,
const string &body) {
802 begin_request(HTTPEnum::M_put, url, body,
false, 0, 0);
813 INLINE
bool HTTPChannel::
815 begin_request(HTTPEnum::M_delete, url,
string(),
false, 0, 0);
828 INLINE
bool HTTPChannel::
830 begin_request(HTTPEnum::M_trace, url,
string(),
false, 0, 0);
848 INLINE
bool HTTPChannel::
850 begin_request(HTTPEnum::M_connect, url,
string(),
false, 0, 0);
853 return is_connection_ready();
863 INLINE
bool HTTPChannel::
865 begin_request(HTTPEnum::M_options, url,
string(),
false, 0, 0);
885 INLINE
void HTTPChannel::
887 begin_request(HTTPEnum::M_get, url,
string(),
true, 0, 0);
901 INLINE
void HTTPChannel::
902 begin_get_subdocument(
const DocumentSpec &url,
size_t first_byte,
904 begin_request(HTTPEnum::M_get, url,
string(),
true, first_byte, last_byte);
913 INLINE
void HTTPChannel::
915 begin_request(HTTPEnum::M_head, url,
string(),
true, 0, 0);
932 INLINE
void HTTPChannel::
933 begin_post_form(
const DocumentSpec &url,
const string &body) {
934 begin_request(HTTPEnum::M_post, url, body,
true, 0, 0);
955 INLINE
void HTTPChannel::
957 begin_request(HTTPEnum::M_connect, url,
string(),
true, 0, 0);
971 INLINE
size_t HTTPChannel::
972 get_bytes_downloaded()
const {
973 return _bytes_downloaded;
995 INLINE
size_t HTTPChannel::
996 get_bytes_requested()
const {
997 return _bytes_requested;
1017 INLINE
bool HTTPChannel::
1018 is_download_complete()
const {
1019 return (_download_dest != DD_none &&
1020 (_state == S_read_body || _state == S_read_trailer));
1028 INLINE HTTPChannel::StatusEntry::
1030 _status_code = SC_incomplete;
A container for a URL, e.g.
const string & get_url() const
Returns the complete URL specification.
A descriptor that refers to a particular version of a document.