add OPTIONS method

This commit is contained in:
David Rose 2003-03-25 23:34:08 +00:00
parent aee3bf8fae
commit b0fbd85234
5 changed files with 27 additions and 0 deletions

View File

@ -590,6 +590,20 @@ connect_to(const DocumentSpec &url) {
return is_connection_ready();
}
////////////////////////////////////////////////////////////////////
// Function: HTTPChannel::get_options
// Access: Published
// Description: Sends an OPTIONS message to the server, which should
// query the available options, possibly in relation to
// a specified URL.
////////////////////////////////////////////////////////////////////
INLINE bool HTTPChannel::
get_options(const DocumentSpec &url) {
begin_request(HTTPEnum::M_options, url, string(), false, 0, 0);
run();
return is_valid();
}
////////////////////////////////////////////////////////////////////
// Function: HTTPChannel::begin_get_document
// Access: Published

View File

@ -2306,6 +2306,13 @@ make_header() {
request_path = _request.get_url().get_path();
}
// HTTP syntax always requires something in the request path. If it
// is empty, put in a star as a placeholder (OPTIONS, for instance,
// uses this).
if (request_path.empty()) {
request_path = "*";
}
ostringstream stream;
stream

View File

@ -126,6 +126,7 @@ PUBLISHED:
INLINE bool delete_document(const DocumentSpec &url);
INLINE bool get_trace(const DocumentSpec &url);
INLINE bool connect_to(const DocumentSpec &url);
INLINE bool get_options(const DocumentSpec &url);
INLINE void begin_get_document(const DocumentSpec &url);
INLINE void begin_get_subdocument(const DocumentSpec &url,

View File

@ -27,6 +27,10 @@
ostream &
operator << (ostream &out, HTTPEnum::Method method) {
switch (method) {
case HTTPEnum::M_options:
out << "OPTIONS";
break;
case HTTPEnum::M_get:
out << "GET";
break;

View File

@ -44,6 +44,7 @@ public:
};
enum Method {
M_options,
M_get,
M_head,
M_post,