本文整理汇总了C++中buffer_is_equal_string函数的典型用法代码示例。如果您正苦于以下问题:C++ buffer_is_equal_string函数的具体用法?C++ buffer_is_equal_string怎么用?C++ buffer_is_equal_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buffer_is_equal_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mod_setenv_patch_connection
static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(request_header);
PATCH(response_header);
PATCH(environment);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.add-request-header"))) {
PATCH(request_header);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.add-response-header"))) {
PATCH(response_header);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.add-environment"))) {
PATCH(environment);
}
}
}
return 0;
}
示例2: mod_magnet_patch_connection
static int mod_magnet_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(url_raw);
PATCH(physical_path);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN(MAGNET_CONFIG_RAW_URL))) {
PATCH(url_raw);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(MAGNET_CONFIG_PHYSICAL_PATH))) {
PATCH(physical_path);
}
}
}
return 0;
}
示例3: mod_cgi_patch_connection
static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH_OPTION(cgi);
PATCH_OPTION(execute_all);
PATCH_OPTION(execute_x_only);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ASSIGN))) {
PATCH_OPTION(cgi);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXECUTE_ALL))) {
PATCH_OPTION(execute_all);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXECUTE_X_ONLY))) {
PATCH_OPTION(execute_x_only);
}
}
}
return 0;
}
示例4: mod_lisp_patch_connection
static int mod_lisp_patch_connection(server *srv, connection *con, plugin_data *p)
#define PATCH(x) p->conf.x = s->x
{
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(LispUseHandler);
PATCH(LispServerId);
PATCH(LispServerPort);
PATCH(LispServerIP);
PATCH(loglevel);
PATCH(LispSocketPoolSize);
/* Skip the first, global context. */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
if (!config_check_cond(srv, con, dc)) continue; /* Condition did not match. */
for (j = 0; j < dc->value->used; j++) { /* Merge config. */
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("lisp.use-handler")))
PATCH(LispUseHandler);
else if (buffer_is_equal_string(du->key, CONST_STR_LEN("lisp.server-id")))
PATCH(LispServerId);
else if (buffer_is_equal_string(du->key, CONST_STR_LEN("lisp.server-ip")))
PATCH(LispServerIP);
else if (buffer_is_equal_string(du->key, CONST_STR_LEN("lisp.server-port")))
PATCH(LispServerPort);
else if (buffer_is_equal_string(du->key, CONST_STR_LEN("lisp.log-level")))
PATCH(loglevel);
}
}
return 0;
}
示例5: mod_bitsvhd_patch_connection
static int mod_bitsvhd_patch_connection(server *srv, connection *con,
plugin_data *p)
{
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(activate);
PATCH(sparse);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key,
CONST_STR_LEN("bitsvhd.activate"))) {
PATCH(activate);
} else if (buffer_is_equal_string(du->key,
CONST_STR_LEN("bitsvhd.sparse"))) {
PATCH(sparse);
}
}
}
return 0;
}
示例6: mod_usertrack_patch_connection
static int mod_usertrack_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(cookie_name);
PATCH(cookie_domain);
PATCH(cookie_max_age);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("usertrack.cookie-name"))) {
PATCH(cookie_name);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("usertrack.cookie-max-age"))) {
PATCH(cookie_max_age);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("usertrack.cookie-domain"))) {
PATCH(cookie_domain);
}
}
}
return 0;
}
示例7: mod_secdownload_patch_connection
static int mod_secdownload_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(secret);
PATCH(doc_root);
PATCH(uri_prefix);
PATCH(timeout);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.secret"))) {
PATCH(secret);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.document-root"))) {
PATCH(doc_root);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.uri-prefix"))) {
PATCH(uri_prefix);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.timeout"))) {
PATCH(timeout);
}
}
}
return 0;
}
示例8: mod_staticfile_patch_connection
static int mod_staticfile_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(exclude_ext);
PATCH(etags_used);
PATCH(disable_pathinfo);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.exclude-extensions"))) {
PATCH(exclude_ext);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.etags"))) {
PATCH(etags_used);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.disable-pathinfo"))) {
PATCH(disable_pathinfo);
}
}
}
return 0;
}
示例9: run_buffer_path_simplify
static void run_buffer_path_simplify(buffer *psrc, buffer *pdest, const char *in, size_t in_len, const char *out, size_t out_len) {
buffer_copy_string_len(psrc, in, in_len);
buffer_path_simplify(pdest, psrc);
if (!buffer_is_equal_string(pdest, out, out_len)) {
fprintf(stderr,
"%s.%d: buffer_path_simplify('%s') failed: expected '%s', got '%s'\n",
__FILE__,
__LINE__,
in,
out,
pdest->ptr ? pdest->ptr : "");
fflush(stderr);
abort();
} else {
if (psrc != pdest) buffer_copy_buffer(psrc, pdest);
buffer_path_simplify(pdest, psrc);
if (!buffer_is_equal_string(pdest, out, out_len)) {
fprintf(stderr,
"%s.%d: buffer_path_simplify('%s') failed - not idempotent: expected '%s', got '%s'\n",
__FILE__,
__LINE__,
in,
out,
pdest->ptr ? pdest->ptr : "");
fflush(stderr);
abort();
}
}
}
示例10: proxy_create_env
static int proxy_create_env(server *srv, handler_ctx *hctx) {
size_t i;
connection *con = hctx->remote_conn;
buffer *b;
/* build header */
b = buffer_init();
/* request line */
buffer_copy_string(b, get_http_method_name(con->request.http_method));
buffer_append_string_len(b, CONST_STR_LEN(" "));
buffer_append_string_buffer(b, con->request.uri);
buffer_append_string_len(b, CONST_STR_LEN(" HTTP/1.0\r\n"));
proxy_append_header(con, "X-Forwarded-For", (char *)inet_ntop_cache_get_ip(srv, &(con->dst_addr)));
/* http_host is NOT is just a pointer to a buffer
* which is NULL if it is not set */
if (!buffer_string_is_empty(con->request.http_host)) {
proxy_set_header(con, "X-Host", con->request.http_host->ptr);
}
proxy_set_header(con, "X-Forwarded-Proto", con->uri.scheme->ptr);
/* request header */
for (i = 0; i < con->request.headers->used; i++) {
data_string *ds;
ds = (data_string *)con->request.headers->data[i];
if (!buffer_is_empty(ds->value) && !buffer_is_empty(ds->key)) {
if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Connection"))) continue;
if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Proxy-Connection"))) continue;
buffer_append_string_buffer(b, ds->key);
buffer_append_string_len(b, CONST_STR_LEN(": "));
buffer_append_string_buffer(b, ds->value);
buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
}
}
buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
hctx->wb->bytes_in += buffer_string_length(b);
chunkqueue_append_buffer(hctx->wb, b);
buffer_free(b);
/* body */
if (con->request.content_length) {
chunkqueue *req_cq = con->request_content_queue;
chunkqueue_steal(hctx->wb, req_cq, req_cq->bytes_in);
}
return 0;
}
示例11: test_buffer_append_path_len
static void test_buffer_append_path_len(void) {
buffer *b = buffer_init();
buffer_append_path_len(b, CONST_STR_LEN("a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a")));
buffer_clear(b);
buffer_append_path_len(b, CONST_STR_LEN("a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a")));
buffer_clear(b);
buffer_append_path_len(b, CONST_STR_LEN("/a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a")));
buffer_copy_string_len(b, CONST_STR_LEN("/"));
buffer_append_path_len(b, CONST_STR_LEN("a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a")));
buffer_copy_string_len(b, CONST_STR_LEN("/"));
buffer_append_path_len(b, CONST_STR_LEN("/a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a")));
buffer_copy_string_len(b, CONST_STR_LEN("a"));
buffer_append_path_len(b, CONST_STR_LEN("a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("a/a")));
buffer_copy_string_len(b, CONST_STR_LEN("a/"));
buffer_append_path_len(b, CONST_STR_LEN("a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("a/a")));
buffer_copy_string_len(b, CONST_STR_LEN("a/"));
buffer_append_path_len(b, CONST_STR_LEN("/a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("a/a")));
buffer_copy_string_len(b, CONST_STR_LEN("/a/"));
buffer_append_path_len(b, CONST_STR_LEN("/a"));
assert(buffer_is_equal_string(b, CONST_STR_LEN("/a/a")));
buffer_free(b);
}
示例12: mod_accesslog_patch_connection
static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(access_logfile);
PATCH(format);
PATCH(log_access_fd);
PATCH(last_generated_accesslog_ts_ptr);
PATCH(access_logbuffer);
PATCH(ts_accesslog_str);
PATCH(ts_accesslog_fmt_str);
PATCH(append_tz_offset);
PATCH(parsed_format);
PATCH(use_syslog);
PATCH(syslog_level);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.filename"))) {
PATCH(access_logfile);
PATCH(log_access_fd);
PATCH(access_logbuffer);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.format"))) {
PATCH(format);
PATCH(parsed_format);
PATCH(last_generated_accesslog_ts_ptr);
PATCH(ts_accesslog_str);
PATCH(ts_accesslog_fmt_str);
PATCH(append_tz_offset);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.use-syslog"))) {
PATCH(use_syslog);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("accesslog.syslog-level"))) {
PATCH(syslog_level);
}
}
}
return 0;
}
示例13: test_buffer_to_lower_upper
static void test_buffer_to_lower_upper(void) {
buffer *psrc = buffer_init();
buffer_copy_string_len(psrc, CONST_STR_LEN("0123456789abcdefghijklmnopqrstuvwxyz"));
buffer_to_lower(psrc);
assert(buffer_is_equal_string(psrc, CONST_STR_LEN("0123456789abcdefghijklmnopqrstuvwxyz")));
buffer_to_upper(psrc);
assert(buffer_is_equal_string(psrc, CONST_STR_LEN("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
buffer_to_upper(psrc);
assert(buffer_is_equal_string(psrc, CONST_STR_LEN("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
buffer_to_lower(psrc);
assert(buffer_is_equal_string(psrc, CONST_STR_LEN("0123456789abcdefghijklmnopqrstuvwxyz")));
buffer_free(psrc);
}
示例14: mod_evasive_patch_connection
static int mod_evasive_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH_OPTION(max_conns);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.max-conns-per-ip"))) {
PATCH_OPTION(max_conns);
}
}
}
return 0;
}
示例15: check_base64
inline
static void check_base64 (char *out, const size_t out_sz, const char *in, const size_t in_len, const base64_charset enc) {
force_assert(out_sz == li_to_base64_no_padding(out, out_sz, (const unsigned char *)in, in_len, enc));
buffer_reset(check);
force_assert(NULL != buffer_append_base64_decode(check, out, out_sz, enc));
force_assert(buffer_is_equal_string(check, in, in_len));
}