35 #include <libxml/xmlIO.h>
50 struct https_context {
58 extern "C" int https_input_match(
const char * uri);
64 extern "C" void * https_input_open(
const char * uri);
78 extern "C" int https_input_close(
void *
context);
88 #ifndef HTTPS_ERRORS_USE_POD
89 #define HTTPS_ERRORS_USE_POD 1
93 #if (defined(NCBI_OS_DARWIN) || defined(NCBI_OS_BSD)) \
94 && defined(NCBI_COMPILER_ANY_CLANG)
95 #ifndef HTTPS_ERRORS_USE_POD
96 #define HTTPS_ERRORS_USE_POD 1
112 if (xmlRegisterInputCallbacks(https_input_match,
115 https_input_close) == -1)
121 #if defined(HTTPS_ERRORS_USE_POD)
123 delete https_messages;
132 #if defined(HTTPS_ERRORS_USE_POD)
133 if (https_messages) {
135 delete https_messages;
136 https_messages =
NULL;
148 #if defined(HTTPS_ERRORS_USE_POD)
150 https_messages->get_messages().push_back(
154 https_messages.get_messages().push_back(
166 extern "C" int https_input_match(
const char * uri)
168 if (!xmlStrncasecmp(BAD_CAST uri, BAD_CAST
"https://", 8))
174 extern "C" void * https_input_open(
const char * uri)
182 " an https IO context",
191 }
catch (
const std::exception & exc) {
193 "Error creating https stream for URI " +
std::string(uri) +
201 "Unknown error creating https stream for URI " +
215 https_context * ctxt = (https_context *)
context;
217 if (ctxt->stream_->eof())
229 if (ctxt->stream_->GetStatusCode() != 200) {
230 char status_buffer[64];
232 snprintf(status_buffer, 64,
"%d", ctxt->stream_->GetStatusCode());
234 "Error reading from URI " +
235 ctxt->uri_ +
". Last status: " +
237 ctxt->stream_->GetStatusText() +
")",
242 }
catch (
const std::exception & exc) {
244 "Error reading from URI " +
250 "Unknown error reading from URI " +
256 return static_cast<int>(ctxt->stream_->gcount());
260 extern "C" int https_input_close(
void *
context)
262 https_context * ctxt = (https_context *)
context;
265 delete ctxt->stream_;
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
The xml::error_message class is used to store a single error message which may appear while parsing o...
message_type
A type for different type of errors.
The xml::error_messages class is used to store all the error message which are collected while parsin...
void append_messages(const error_messages &other)
Appends the messages from the other container.
const error_messages_type & get_messages(void) const
Get the error messages.
This exception class is thrown by xmlwrapp for all runtime XML-related errors along with the xml::par...
This file contains the definition of the xml::exception class.
Magic spell ;-) needed for some weird compilers... very empiric.
void append_https_message(const std::string &msg, error_message::message_type msg_type, long line, const std::string &fname)
void clear_https_messages(void)
void collect_https_messages(xml::error_messages &append_to)
void register_https_input(void)
static pcre_uint8 * buffer
union __declspec(align(16)) SIMDVec
static CS_CONTEXT * context