diff --git a/panda/src/downloader/httpChannel.I b/panda/src/downloader/httpChannel.I index 4ac3eee1c4..1b46104ebf 100644 --- a/panda/src/downloader/httpChannel.I +++ b/panda/src/downloader/httpChannel.I @@ -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 diff --git a/panda/src/downloader/httpChannel.cxx b/panda/src/downloader/httpChannel.cxx index e07d826346..16b3e30c3d 100644 --- a/panda/src/downloader/httpChannel.cxx +++ b/panda/src/downloader/httpChannel.cxx @@ -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 diff --git a/panda/src/downloader/httpChannel.h b/panda/src/downloader/httpChannel.h index f95f49d2a9..735e11ce26 100644 --- a/panda/src/downloader/httpChannel.h +++ b/panda/src/downloader/httpChannel.h @@ -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, diff --git a/panda/src/downloader/httpEnum.cxx b/panda/src/downloader/httpEnum.cxx index 1dbfed87c0..be60541148 100644 --- a/panda/src/downloader/httpEnum.cxx +++ b/panda/src/downloader/httpEnum.cxx @@ -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; diff --git a/panda/src/downloader/httpEnum.h b/panda/src/downloader/httpEnum.h index 6c7146a8cb..00bc90822a 100644 --- a/panda/src/downloader/httpEnum.h +++ b/panda/src/downloader/httpEnum.h @@ -44,6 +44,7 @@ public: }; enum Method { + M_options, M_get, M_head, M_post,