void add_cookies(unsigned char **s, int *l, unsigned char *url) { int nc = 0; struct c_domain *cd; struct cookie *c, *d; unsigned char *server = get_host_name(url); unsigned char *data = get_url_data(url); if (data > url) data--; foreach (cd, c_domains) if (is_in_domain(cd->domain, server)) goto ok; mem_free(server); return; ok: foreachback (c, all_cookies) if (is_in_domain(c->domain, server)) if (is_path_prefix(c->path, data)) { if (cookie_expired(c)) { d = c; c = c->prev; del_from_list(d); free_cookie(d); mem_free(d); continue; } if (c->secure && casecmp(url, cast_uchar "https://", 8)) continue; if (!nc) add_to_str(s, l, cast_uchar "Cookie: "), nc = 1; else add_to_str(s, l, cast_uchar "; "); add_to_str(s, l, c->name); if (c->value) { add_to_str(s, l, cast_uchar "="); add_to_str(s, l, c->value); } } if (nc) add_to_str(s, l, cast_uchar "\r\n"); mem_free(server); }
void test_is_in_domain (const Mesh_domain& domain) const { typedef typename Mesh_domain::Is_in_domain Is_in_domain; typedef typename Mesh_domain::Subdomain Subdomain; typedef typename Mesh_domain::Subdomain_index Subdomain_index; Is_in_domain is_in_domain = domain.is_in_domain_object(); { Subdomain subdomain = is_in_domain(Point_3(CGAL::ORIGIN)); assert(subdomain); Subdomain_index subdomain_index = *subdomain; assert(subdomain_index == 1); } { Subdomain subdomain = is_in_domain(Point_3(1.5, 0., 0.)); assert(!subdomain); } }
/* Look for the option with the given name in all domain shadow-trees that * match the given domain-name. Return the option from the the shadow tree * that best matches the given domain name. */ static struct option * get_domain_option(unsigned char *domain_name, int domain_len, unsigned char *name) { struct option *opt, *longest_match_opt = NULL; struct domain_tree *longest_match = NULL; struct domain_tree *domain; assert(domain_name); assert(*domain_name); foreach (domain, domain_trees) if ((!longest_match || domain->len > longest_match->len) && is_in_domain(domain->name, domain_name, domain_len) && (opt = get_opt_rec_real(domain->tree, name))) { longest_match = domain; longest_match_opt = opt; } return longest_match_opt; }
/* Start a new request. */ void http_auth_new_request(http_auth_session *sess, const char *method, const char *uri, const char *body_buffer, FILE *body_stream) { if (!sess->can_handle) { DEBUG(DEBUG_HTTPAUTH, "Not handling session.\n"); } else if (!is_in_domain(sess, uri)) { /* We have moved out of the authentication domain */ DEBUG(DEBUG_HTTPAUTH, "URI %s outside session domain, not handling.\n", uri); sess->will_handle = 0; } else { DEBUG(DEBUG_HTTPAUTH, "URI %s inside session domain, will handle.\n", uri); sess->will_handle = 1; sess->uri = uri; sess->method = method; sess->got_body = (body_buffer!=NULL) || (body_stream!=NULL); sess->body_buffer = body_buffer; sess->body_stream = body_stream; md5_init_ctx(&sess->response_body); } }
void convert_to_dealii_format(CDT &cdt, dealii::Triangulation<2> &triangulation) { std::vector<dealii::Point<2> > vertex_in_grid; std::vector<dealii::CellData<2> > cell_in_grid; for(auto fit = cdt.finite_faces_begin(); fit != cdt.finite_faces_end(); ++fit) { CDT::Triangle trg = cdt.triangle(fit); // location of points on the triangle // // 2 // / \ // / \ // / \ // / \ // 5 / \ 4 // /\ /\ // / \ / \ // / \ / \ // / \ / \ // / 6 \ // / | \ // / | \ // / | \ // 0___________________________1 // 3 // dealii::Point<2> p[7] = { dealii::Point<2>(trg[0].x(), trg[0].y()), dealii::Point<2>(trg[1].x(), trg[1].y()), dealii::Point<2>(trg[2].x(), trg[2].y()), (p[0] + p[1]) / 2.0, (p[1] + p[2]) / 2.0, (p[2] + p[0]) / 2.0, (p[0] + p[1] + p[2]) / 3.0 }; struct IndexPoint { u32 index; bool point_already_exist = false; }; IndexPoint index_point[7]; FOR(i, 0, 7) FOR(j, 0, vertex_in_grid.size()) if (p[i].distance (vertex_in_grid[j]) < 1.e-10) { index_point[i].index = j; index_point[i].point_already_exist = true; }; FOR(i, 0, 7) if (not index_point[i].point_already_exist) { vertex_in_grid .push_back (p[i]); index_point[i].index = vertex_in_grid.size() - 1; index_point[i].point_already_exist = true; }; u8 mat_id = fit->is_in_domain() ? 0 : 1; auto add_cell = [&cell_in_grid, &index_point, mat_id] (arr<st, 4> &&indx) { cell_in_grid .push_back (dealii::CellData<2>{ index_point[indx[0]].index, index_point[indx[1]].index, index_point[indx[2]].index, index_point[indx[3]].index, {.material_id = mat_id}}); };