static bool verify_captcha(request_context *ctx) { if (!ctx->px_captcha) { return false; } px_config *conf = ctx->conf; const char *domain = ""; if (conf->captcha_subdomain) { get_host_domain(ctx, &domain); } // preventing reuse of captcha cookie by deleting it apr_status_t res = ap_cookie_remove(ctx->r, CAPTCHA_COOKIE, domain, ctx->r->headers_out, ctx->r->err_headers_out, NULL); if (res != APR_SUCCESS) { px_log_debug("Could not remove _pxCaptcha from request"); } char *payload = create_captcha_payload(ctx, conf); if (!payload) { px_log_debug_fmt("failed to format captcha payload. url: %s", ctx->full_url); ctx->pass_reason = PASS_REASON_ERROR; return true; } char *response_str = NULL; CURLcode status = post_request(conf->captcha_api_url, payload, conf->connect_timeout_ms, conf->captcha_timeout, conf, ctx, &response_str, &ctx->api_rtt); free(payload); if (status == CURLE_OK) { px_log_debug_fmt("server response %s", response_str); captcha_response *c = parse_captcha_response(response_str, ctx); free(response_str); bool passed = (c && c->status == 0); if (passed) { ctx->pass_reason = PASS_REASON_CAPTCHA; } return passed; } if (status == CURLE_OPERATION_TIMEDOUT) { ctx->pass_reason = PASS_REASON_CAPTCHA_TIMEOUT; px_log_debug("Captcha response timeout - passing request"); } else { ctx->pass_reason = PASS_REASON_ERROR; px_log_debug_fmt("failed to perform captcha validation request. url: %s", ctx->full_url); } return false; }
int ObClientManager::post_request(const ObServer& server, const int32_t pcode, const int32_t version, const ObDataBuffer& in_buffer) const { // default packet timeout = 0 return post_request(server, pcode, version, 0, in_buffer, NULL, NULL); }
static void do_meta_request(kdev_t device) { struct ud_driver *driver = get_driver(major); struct ud_request *udr; struct request *req; char *buff; int major = MAJOR(device); printk("do_meta_request %d %x\n", major, blk_dev[major].current_request); if (NULL == driver) { end_request(0, req->rq_dev); return; } printk("1"); while (1) { req = blk_dev[major].current_request; printk("2"); if (!req || req->rq_dev < 0 || req->rq_sector == -1) return; printk("5"); udr = new_request(); udr->udr_type = UDR_BLK + req->rq_cmd; udr->udr_ptr = req->rq_sector; udr->udr_minor = MINOR(req->rq_dev); printk("6"); post_request(driver, udr); printk("7"); /* Should really check here whether we have a request */ if (req->rq_cmd == WRITE) { /* Can't do this, copies to the wrong task */ #if 0 verified_memcpy_tofs(driver->udd_data, buff, BLOCK_SIZE); /* FIXME FIXME */ fmemcpy(driver->udd_task->mm.dseg, driver->udd_data, get_ds(), buff, 1024); #endif } printk("8"); /* Wake up the driver so it can deal with the request */ wake_up(&driver->udd_wait); printk("request init: wake driver, sleeping\n"); sleep_on(&udr->udr_wait); printk("request continue\n"); /* REQUEST HAS BEEN RETURNED BY USER PROGRAM */ /* request must be dealt with and ended */ if (udr->udr_status == 1) { end_request(0, req->rq_dev); udr->udr_status = 0; continue; } udr->udr_status = 0; buff = req->rq_buffer; if (req->rq_cmd == READ) { /* Can't do this, copies from the wrong task */ #if 0 verified_memcpy_fromfs(buff, driver->udd_data, BLOCK_SIZE); /* FIXME FIXME */ fmemcpy(get_ds(), buff, driver->udd_task->mm.dseg, driver->udd_data, 1024); #endif } end_request(1, req->rq_dev); wake_up(&udr->udr_wait); } }
//--------------------------------------------------------------------------------------- std::string LibraryScope::get_font(const string& name, bool fBold, bool fItalic) { RequestFont request(name, fBold, fItalic); post_request(&request); return request.get_font_fullname(); }