mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
add put, delete, trace methods
This commit is contained in:
parent
3c159a7bcf
commit
1ad6b0310f
@ -383,19 +383,6 @@ reset() {
|
||||
reset_to_new();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::post_form
|
||||
// Access: Published
|
||||
// Description: Posts form data to a particular URL and retrieves the
|
||||
// response.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool HTTPChannel::
|
||||
post_form(const URLSpec &url, const string &body) {
|
||||
begin_request(HTTPEnum::M_post, url, body, false, 0, 0);
|
||||
run();
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::get_document
|
||||
// Access: Published
|
||||
@ -442,6 +429,58 @@ get_header(const URLSpec &url) {
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::post_form
|
||||
// Access: Published
|
||||
// Description: Posts form data to a particular URL and retrieves the
|
||||
// response.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool HTTPChannel::
|
||||
post_form(const URLSpec &url, const string &body) {
|
||||
begin_request(HTTPEnum::M_post, url, body, false, 0, 0);
|
||||
run();
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::put_document
|
||||
// Access: Published
|
||||
// Description: Uploads the indicated body to the server to replace
|
||||
// the indicated URL, if the server allows this.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool HTTPChannel::
|
||||
put_document(const URLSpec &url, const string &body) {
|
||||
begin_request(HTTPEnum::M_put, url, body, false, 0, 0);
|
||||
run();
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::delete_document
|
||||
// Access: Published
|
||||
// Description: Requests the server to remove the indicated URL.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool HTTPChannel::
|
||||
delete_document(const URLSpec &url) {
|
||||
begin_request(HTTPEnum::M_delete, url, string(), false, 0, 0);
|
||||
run();
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::get_trace
|
||||
// Access: Published
|
||||
// Description: Sends a TRACE message to the server, which should
|
||||
// return back the same message as the server received
|
||||
// it, allowing inspection of proxy hops, etc.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool HTTPChannel::
|
||||
get_trace(const URLSpec &url) {
|
||||
begin_request(HTTPEnum::M_trace, url, string(), false, 0, 0);
|
||||
run();
|
||||
return is_valid();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::connect_to
|
||||
// Access: Published
|
||||
@ -461,25 +500,6 @@ connect_to(const URLSpec &url) {
|
||||
return is_connection_ready();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::begin_post_form
|
||||
// Access: Published
|
||||
// Description: Posts form data to a particular URL and retrieves the
|
||||
// response, all using non-blocking I/O. See
|
||||
// begin_get_document() and post_form().
|
||||
//
|
||||
// It is important to note that you *must* call run()
|
||||
// repeatedly after calling this method until run()
|
||||
// returns false, and you may not call any other
|
||||
// document posting or retrieving methods using the
|
||||
// HTTPChannel object in the interim, or your form data
|
||||
// may not get posted.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void HTTPChannel::
|
||||
begin_post_form(const URLSpec &url, const string &body) {
|
||||
begin_request(HTTPEnum::M_post, url, body, true, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::begin_get_document
|
||||
// Access: Published
|
||||
@ -527,6 +547,25 @@ begin_get_header(const URLSpec &url) {
|
||||
begin_request(HTTPEnum::M_head, url, string(), true, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::begin_post_form
|
||||
// Access: Published
|
||||
// Description: Posts form data to a particular URL and retrieves the
|
||||
// response, all using non-blocking I/O. See
|
||||
// begin_get_document() and post_form().
|
||||
//
|
||||
// It is important to note that you *must* call run()
|
||||
// repeatedly after calling this method until run()
|
||||
// returns false, and you may not call any other
|
||||
// document posting or retrieving methods using the
|
||||
// HTTPChannel object in the interim, or your form data
|
||||
// may not get posted.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void HTTPChannel::
|
||||
begin_post_form(const URLSpec &url, const string &body) {
|
||||
begin_request(HTTPEnum::M_post, url, body, true, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: HTTPChannel::begin_connect_to
|
||||
// Access: Published
|
||||
|
@ -109,18 +109,21 @@ PUBLISHED:
|
||||
|
||||
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,
|
||||
size_t first_byte, size_t last_byte);
|
||||
INLINE bool get_header(const URLSpec &url);
|
||||
INLINE bool post_form(const URLSpec &url, const string &body);
|
||||
INLINE bool put_document(const URLSpec &url, const string &body);
|
||||
INLINE bool delete_document(const URLSpec &url);
|
||||
INLINE bool get_trace(const URLSpec &url);
|
||||
INLINE bool connect_to(const URLSpec &url);
|
||||
|
||||
INLINE void begin_post_form(const URLSpec &url, const string &body);
|
||||
INLINE void begin_get_document(const URLSpec &url);
|
||||
INLINE void begin_get_subdocument(const URLSpec &url,
|
||||
size_t first_byte, size_t last_byte);
|
||||
INLINE void begin_get_header(const URLSpec &url);
|
||||
INLINE void begin_post_form(const URLSpec &url, const string &body);
|
||||
bool run();
|
||||
INLINE void begin_connect_to(const URLSpec &url);
|
||||
|
||||
|
@ -39,6 +39,18 @@ operator << (ostream &out, HTTPEnum::Method method) {
|
||||
out << "POST";
|
||||
break;
|
||||
|
||||
case HTTPEnum::M_put:
|
||||
out << "PUT";
|
||||
break;
|
||||
|
||||
case HTTPEnum::M_delete:
|
||||
out << "DELETE";
|
||||
break;
|
||||
|
||||
case HTTPEnum::M_trace:
|
||||
out << "TRACE";
|
||||
break;
|
||||
|
||||
case HTTPEnum::M_connect:
|
||||
out << "CONNECT";
|
||||
break;
|
||||
|
@ -47,7 +47,10 @@ public:
|
||||
M_get,
|
||||
M_head,
|
||||
M_post,
|
||||
M_connect
|
||||
M_put,
|
||||
M_delete,
|
||||
M_trace,
|
||||
M_connect,
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user