17INLINE HTTPClient *HTTPChannel::
26INLINE
bool HTTPChannel::
28 return (_state != S_failure && (get_status_code() / 100) == 2 &&
29 (_server_response_has_no_body || !_source.is_null()));
36INLINE
bool HTTPChannel::
37is_connection_ready()
const {
38 return (!_source.is_null() && _state == S_ready);
47INLINE
const URLSpec &HTTPChannel::
49 return _document_spec.
get_url();
62get_document_spec()
const {
63 return _document_spec;
70INLINE HTTPEnum::HTTPVersion HTTPChannel::
71get_http_version()
const {
79INLINE
const std::string &HTTPChannel::
80get_http_version_string()
const {
81 return _http_version_string;
94INLINE
int HTTPChannel::
95get_status_code()
const {
96 return _status_entry._status_code;
106INLINE
const std::string &HTTPChannel::
107get_www_realm()
const {
117INLINE
const std::string &HTTPChannel::
118get_proxy_realm()
const {
129INLINE
const URLSpec &HTTPChannel::
130get_redirect()
const {
139INLINE
int HTTPChannel::
140get_num_redirect_steps()
const {
141 return _redirect_trail.size();
149INLINE
const URLSpec &HTTPChannel::
150get_redirect_step(
int n)
const {
151 nassertr(n >= 0 && n < (
int)_redirect_trail.size(), _redirect_trail[0]);
152 return _redirect_trail[n];
165INLINE
void HTTPChannel::
166set_persistent_connection(
bool persistent_connection) {
167 _persistent_connection = persistent_connection;
176INLINE
bool HTTPChannel::
177get_persistent_connection()
const {
178 return _persistent_connection;
188INLINE
void HTTPChannel::
189set_allow_proxy(
bool allow_proxy) {
190 _allow_proxy = allow_proxy;
200INLINE
bool HTTPChannel::
201get_allow_proxy()
const {
220INLINE
void HTTPChannel::
221set_proxy_tunnel(
bool proxy_tunnel) {
222 _proxy_tunnel = proxy_tunnel;
230INLINE
bool HTTPChannel::
231get_proxy_tunnel()
const {
232 return _proxy_tunnel;
243INLINE
void HTTPChannel::
244set_connect_timeout(
double connect_timeout) {
245 _connect_timeout = connect_timeout;
252INLINE
double HTTPChannel::
253get_connect_timeout()
const {
254 return _connect_timeout;
269INLINE
void HTTPChannel::
270set_blocking_connect(
bool blocking_connect) {
271 _blocking_connect = blocking_connect;
280INLINE
bool HTTPChannel::
281get_blocking_connect()
const {
282 return _blocking_connect;
296INLINE
void HTTPChannel::
297set_http_timeout(
double http_timeout) {
298 _http_timeout = http_timeout;
305INLINE
double HTTPChannel::
306get_http_timeout()
const {
307 return _http_timeout;
322INLINE
void HTTPChannel::
323set_skip_body_size(
size_t skip_body_size) {
324 _skip_body_size = skip_body_size;
332INLINE
size_t HTTPChannel::
333get_skip_body_size()
const {
334 return _skip_body_size;
344INLINE
void HTTPChannel::
345set_idle_timeout(
double idle_timeout) {
346 _idle_timeout = idle_timeout;
353INLINE
double HTTPChannel::
354get_idle_timeout()
const {
355 return _idle_timeout;
373INLINE
void HTTPChannel::
374set_download_throttle(
bool download_throttle) {
375 _download_throttle = download_throttle;
382INLINE
bool HTTPChannel::
383get_download_throttle()
const {
384 return _download_throttle;
392INLINE
void HTTPChannel::
393set_max_bytes_per_second(
double max_bytes_per_second) {
394 _max_bytes_per_second = max_bytes_per_second;
395 _bytes_per_update = int(_max_bytes_per_second * _seconds_per_update);
402INLINE
double HTTPChannel::
403get_max_bytes_per_second()
const {
404 return _max_bytes_per_second;
412INLINE
void HTTPChannel::
413set_max_updates_per_second(
double max_updates_per_second) {
414 nassertv(max_updates_per_second != 0.0f);
415 _max_updates_per_second = max_updates_per_second;
416 _seconds_per_update = 1.0f / _max_updates_per_second;
417 _bytes_per_update = int(_max_bytes_per_second * _seconds_per_update);
424INLINE
double HTTPChannel::
425get_max_updates_per_second()
const {
426 return _max_updates_per_second;
433INLINE
void HTTPChannel::
434set_content_type(std::string content_type) {
435 _content_type = content_type;
441INLINE std::string HTTPChannel::
442get_content_type()
const {
443 return _content_type;
453INLINE
void HTTPChannel::
454set_expected_file_size(
size_t file_size) {
455 _expected_file_size = file_size;
456 _got_expected_file_size =
true;
467INLINE
bool HTTPChannel::
468is_file_size_known()
const {
469 return _got_file_size;
478INLINE
size_t HTTPChannel::
479get_first_byte_requested()
const {
480 return _first_byte_requested;
489INLINE
size_t HTTPChannel::
490get_last_byte_requested()
const {
491 return _last_byte_requested;
501INLINE
size_t HTTPChannel::
502get_first_byte_delivered()
const {
503 return _first_byte_delivered;
513INLINE
size_t HTTPChannel::
514get_last_byte_delivered()
const {
515 return _last_byte_delivered;
529INLINE
void HTTPChannel::
531 reset_for_new_request();
533 _status_list.clear();
546INLINE
void HTTPChannel::
548 _status_list.push_back(_status_entry);
556INLINE
void HTTPChannel::
557clear_extra_headers() {
558 _send_extra_headers = std::string();
570INLINE
void HTTPChannel::
571send_extra_header(
const std::string &key,
const std::string &value) {
572 _send_extra_headers += key;
573 _send_extra_headers +=
": ";
574 _send_extra_headers += value;
575 _send_extra_headers +=
"\r\n";
582INLINE
bool HTTPChannel::
584 begin_request(HTTPEnum::M_get, url, std::string(),
false, 0, 0);
597INLINE
bool HTTPChannel::
598get_subdocument(
const DocumentSpec &url,
size_t first_byte,
size_t last_byte) {
599 begin_request(HTTPEnum::M_get, url, std::string(),
false, first_byte, last_byte);
611INLINE
bool HTTPChannel::
613 begin_request(HTTPEnum::M_head, url, std::string(),
false, 0, 0);
622INLINE
bool HTTPChannel::
623post_form(
const DocumentSpec &url,
const std::string &body) {
624 begin_request(HTTPEnum::M_post, url, body,
false, 0, 0);
634INLINE
bool HTTPChannel::
635put_document(
const DocumentSpec &url,
const std::string &body) {
636 begin_request(HTTPEnum::M_put, url, body,
false, 0, 0);
645INLINE
bool HTTPChannel::
647 begin_request(HTTPEnum::M_delete, url, std::string(),
false, 0, 0);
657INLINE
bool HTTPChannel::
659 begin_request(HTTPEnum::M_trace, url, std::string(),
false, 0, 0);
672INLINE
bool HTTPChannel::
674 begin_request(HTTPEnum::M_connect, url, std::string(),
false, 0, 0);
677 return is_connection_ready();
684INLINE
bool HTTPChannel::
686 begin_request(HTTPEnum::M_options, url, std::string(),
false, 0, 0);
701INLINE
void HTTPChannel::
703 begin_request(HTTPEnum::M_get, url, std::string(),
true, 0, 0);
713INLINE
void HTTPChannel::
714begin_get_subdocument(
const DocumentSpec &url,
size_t first_byte,
716 begin_request(HTTPEnum::M_get, url, std::string(),
true, first_byte, last_byte);
723INLINE
void HTTPChannel::
725 begin_request(HTTPEnum::M_head, url, std::string(),
true, 0, 0);
737INLINE
void HTTPChannel::
738begin_post_form(
const DocumentSpec &url,
const std::string &body) {
739 begin_request(HTTPEnum::M_post, url, body,
true, 0, 0);
754INLINE
void HTTPChannel::
756 begin_request(HTTPEnum::M_connect, url, std::string(),
true, 0, 0);
766INLINE
size_t HTTPChannel::
767get_bytes_downloaded()
const {
768 return _bytes_downloaded;
784INLINE
size_t HTTPChannel::
785get_bytes_requested()
const {
786 return _bytes_requested;
801INLINE
bool HTTPChannel::
802is_download_complete()
const {
803 return (_download_dest != DD_none &&
804 (_state == S_read_body || _state == S_read_trailer));
810INLINE HTTPChannel::StatusEntry::
812 _status_code = SC_incomplete;
A descriptor that refers to a particular version of a document.
A container for a URL, e.g.
const std::string & get_url() const
Returns the complete URL specification.