parent
1ac351d594
commit
574000aedd
|
|
@ -426,6 +426,23 @@ get_max_updates_per_second() const {
|
|||
return _max_updates_per_second;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the Content-Type header, useful for applications that require
|
||||
* different types of content, such as JSON.
|
||||
*/
|
||||
INLINE void HTTPChannel::
|
||||
set_content_type(string content_type) {
|
||||
_content_type = content_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the Content-Type header.
|
||||
*/
|
||||
INLINE string HTTPChannel::
|
||||
get_content_type() const {
|
||||
return _content_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* This may be called immediately after a call to get_document() or some
|
||||
* related function to specify the expected size of the document we are
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ HTTPChannel(HTTPClient *client) :
|
|||
_response_type = RT_none;
|
||||
_http_version = _client->get_http_version();
|
||||
_http_version_string = _client->get_http_version_string();
|
||||
_content_type = "application/x-www-form-urlencoded";
|
||||
_state = S_new;
|
||||
_done_state = S_new;
|
||||
_started_download = false;
|
||||
|
|
@ -3624,7 +3625,7 @@ make_header() {
|
|||
|
||||
if (!_body.empty()) {
|
||||
stream
|
||||
<< "Content-Type: application/x-www-form-urlencoded\r\n"
|
||||
<< "Content-Type: " << _content_type << "\r\n"
|
||||
<< "Content-Length: " << _body.length() << "\r\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ PUBLISHED:
|
|||
INLINE void set_max_updates_per_second(double max_updates_per_second);
|
||||
INLINE double get_max_updates_per_second() const;
|
||||
|
||||
INLINE void set_content_type(string content_type);
|
||||
INLINE string get_content_type() const;
|
||||
|
||||
INLINE void set_expected_file_size(size_t file_size);
|
||||
streamsize get_file_size() const;
|
||||
INLINE bool is_file_size_known() const;
|
||||
|
|
@ -336,6 +339,7 @@ private:
|
|||
string request_path;
|
||||
string _header;
|
||||
string _body;
|
||||
string _content_type;
|
||||
bool _want_ssl;
|
||||
bool _proxy_serves_document;
|
||||
bool _proxy_tunnel_now;
|
||||
|
|
|
|||
Loading…
Reference in New Issue