开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (6)
标签 (5)
master
revert-35-build-nogzip
http_1.1
boost_locale_merge
v1.0_fixes
multiple-event-loops
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.5
master
分支 (6)
标签 (5)
master
revert-35-build-nogzip
http_1.1
boost_locale_merge
v1.0_fixes
multiple-event-loops
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.5
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (6)
标签 (5)
master
revert-35-build-nogzip
http_1.1
boost_locale_merge
v1.0_fixes
multiple-event-loops
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.5
cppcms
/
src
/
http_api.cpp
cppcms
/
src
/
http_api.cpp
http_api.cpp 19.23 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
///////////////////////////////////////////////////////////////////////////////
#define CPPCMS_SOURCE
//#define DEBUG_HTTP_PARSER
#include "cgi_api.h"
#include "cgi_acceptor.h"
#include <cppcms/service.h>
#include "service_impl.h"
#include "cppcms_error_category.h"
#include <cppcms/json.h>
#include "http_parser.h"
#include <cppcms/config.h>
#include <cppcms/util.h>
#include <string.h>
#include <iostream>
#include <list>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include "binder.h"
// for testing only
#if !defined(__linux) && !defined(CPPCMS_WIN32)
# define CPPCMS_NO_SO_SNDTIMO
#endif
#ifdef CPPCMS_NO_SO_SNDTIMO
#include <poll.h>
#include <errno.h>
#endif
#include <booster/aio/buffer.h>
#include <booster/aio/deadline_timer.h>
#include <booster/aio/aio_category.h>
#include <booster/log.h>
#include "cached_settings.h"
#include "format_number.h"
#include "string_map.h"
#include "send_timeout.h"
#include "rewrite.h"
namespace io = booster::aio;
namespace cppcms {
namespace impl {
namespace cgi {
class http;
class http_watchdog : public booster::enable_shared_from_this<http_watchdog> {
public:
typedef booster::shared_ptr<http> http_ptr;
typedef booster::weak_ptr<http> weak_http_ptr;
http_watchdog(booster::aio::io_service &srv) :
timer_(srv)
{
}
void check(booster::system::error_code const &e=booster::system::error_code());
void add(weak_http_ptr p)
{
connections_.insert(p);
}
void remove(weak_http_ptr p)
{
connections_.erase(p);
}
private:
typedef std::set<weak_http_ptr> connections_type;
connections_type connections_;
booster::aio::deadline_timer timer_;
};
class http_creator {
public:
http_creator() {} // for concept
http_creator(booster::aio::io_service &srv,json::value const &settings,std::string const &ip="0.0.0.0",int port = 8080) :
ip_(ip),port_(port),watchdog_(new http_watchdog(srv))
{
if(settings.find("http.rewrite").type()==json::is_array) {
rewrite_.reset(new url_rewriter(settings.find("http.rewrite").array()));
}
watchdog_->check();
}
http *operator()(cppcms::service &srv) const;
private:
std::string ip_;
int port_;
booster::shared_ptr<http_watchdog> watchdog_;
booster::shared_ptr<url_rewriter> rewrite_;
};
namespace {
char non_const_empty_string[1]={0};
}
class http : public connection {
public:
http( cppcms::service &srv,
std::string const &ip,
int port,
booster::shared_ptr<http_watchdog> wd,
booster::shared_ptr<url_rewriter> rw
)
:
connection(srv),
socket_(srv.impl().get_io_service()),
input_body_ptr_(0),
input_parser_(input_body_,input_body_ptr_),
output_pbase_(0),
output_pptr_(0),
output_epptr_(0),
output_parser_(output_pbase_,output_pptr_,output_epptr_),
request_method_(non_const_empty_string),
request_uri_(non_const_empty_string),
headers_done_(false),
first_header_observerd_(false),
total_read_(0),
time_to_die_(0),
timeout_(0),
sync_option_is_set_(false),
in_watchdog_(false),
watchdog_(wd),
rewrite_(rw),
eof_callback_(false)
{
env_.add("SERVER_SOFTWARE",CPPCMS_PACKAGE_NAME "/" CPPCMS_PACKAGE_VERSION);
env_.add("SERVER_NAME",pool_.add(ip));
char *sport = pool_.alloc(10);
format_number(port,sport,10);
env_.add("SERVER_PORT",sport);
env_.add("GATEWAY_INTERFACE","CGI/1.0");
env_.add("SERVER_PROTOCOL","HTTP/1.0");
timeout_ = srv.cached_settings().http.timeout;
}
~http()
{
if(socket_.native()!=io::invalid_socket) {
booster::system::error_code e;
socket_.shutdown(io::stream_socket::shut_rdwr,e);
}
}
void update_time()
{
time_to_die_ = time(0) + timeout_;
}
void log_timeout()
{
char const *uri = request_uri_;
if(!uri || *uri==0)
uri = "unknown";
BOOSTER_INFO("cppcms_http") << "Timeout on connection for URI: " << uri << " from " << cgetenv("REMOTE_ADDR");
}
void die()
{
log_timeout();
close();
}
void async_die()
{
socket_.cancel();
die();
}
time_t time_to_die()
{
return time_to_die_;
}
void async_read_some_headers(handler const &h)
{
socket_.on_readable(mfunc_to_event_handler(&http::some_headers_data_read,self(),h));
update_time();
}
virtual void async_read_headers(handler const &h)
{
#ifdef CPPCMS_NO_SO_SNDTIMO
booster::system::error_code e;
socket_.set_non_blocking_if_needed(true,e);
if(e) { h(e); return; }
#endif
update_time();
add_to_watchdog();
async_read_some_headers(h);
}
void some_headers_data_read(booster::system::error_code const &er,handler const &h)
{
if(er) { h(er); return; }
booster::system::error_code e;
size_t n = socket_.bytes_readable(e);
if(e) { h(e); return ; }
if(n == 0) {
h(booster::system::error_code(booster::aio::aio_error::eof,booster::aio::aio_error_cat));
return;
}
if(n > 16384)
n=16384;
if(input_body_.capacity() < n) {
input_body_.reserve(n);
}
input_body_.resize(input_body_.capacity(),0);
input_body_ptr_=0;
n = socket_.read_some(booster::aio::buffer(input_body_),e);
total_read_+=n;
input_body_.resize(n);
for(;;) {
using ::cppcms::http::impl::parser;
switch(input_parser_.step()) {
case parser::more_data:
if(total_read_ > 16384) {
h(booster::system::error_code(errc::protocol_violation,cppcms_category));
return;
}
// Assuming body_ptr == body.size()
async_read_some_headers(h);
return;
case parser::got_header:
if(!first_header_observerd_) {
first_header_observerd_=true;
char const *header_begin = input_parser_.header_.c_str();
char const *header_end = header_begin + input_parser_.header_.size();
char const *query=header_end;
char const *rmethod=std::find( header_begin,
header_end,
' ');
if(rmethod!=header_end)
query=std::find(rmethod+1,header_end,' ');
if(query!=header_end) {
request_method_ = pool_.add(header_begin,rmethod);
request_uri_ = pool_.add(rmethod+1,query);
first_header_observerd_=true;
BOOSTER_INFO("cppcms_http") << request_method_ <<" " << request_uri_;
}
else {
h(booster::system::error_code(errc::protocol_violation,cppcms_category));
return;
}
}
else { // Any other header
char const *name = "";
char const *value = "";
if(!parse_single_header(input_parser_.header_,name,value)) {
h(booster::system::error_code(errc::protocol_violation,cppcms_category));
return;
}
if(strcmp(name,"CONTENT_LENGTH")==0 || strcmp(name,"CONTENT_TYPE")==0)
env_.add(name,value);
else {
char *updated_name =pool_.alloc(strlen(name) + 5 + 1);
strcpy(updated_name,"HTTP_");
strcat(updated_name,name);
env_.add(updated_name,value);
}
}
break;
case parser::end_of_headers:
process_request(h);
return;
case parser::error_observerd:
h(booster::system::error_code(errc::protocol_violation,cppcms_category));
return;
}
}
}
virtual void async_read_some(void *p,size_t s,io_handler const &h)
{
update_time();
if(input_body_ptr_==input_body_.size()) {
input_body_.clear();
input_body_ptr_=0;
}
if(!input_body_.empty()) {
if(input_body_.size() - input_body_ptr_ < s) {
s=input_body_.size() - input_body_ptr_;
}
memcpy(p,&input_body_[input_body_ptr_],s);
input_body_ptr_+=s;
if(input_body_ptr_==input_body_.size()) {
input_body_.clear();
input_body_ptr_=0;
}
socket_.get_io_service().post(h,booster::system::error_code(),s);
return;
}
if(input_body_.capacity()!=0) {
std::vector<char> v;
input_body_.swap(v);
}
socket_.async_read_some(io::buffer(p,s),h);
}
virtual void do_eof()
{
if(eof_callback_)
socket_.cancel();
eof_callback_ = false;
booster::system::error_code e;
socket_.shutdown(io::stream_socket::shut_wr,e);
socket_.close(e);
}
#ifndef CPPCMS_NO_SO_SNDTIMO
size_t timed_write_some(booster::aio::const_buffer const &buf,booster::system::error_code &e)
{
socket_.set_non_blocking_if_needed(false,e);
if(e) return 0;
if(!sync_option_is_set_) {
cppcms::impl::set_send_timeout(socket_,timeout_,e);
if(e)
return 0;
sync_option_is_set_ = true;
}
booster::ptime start = booster::ptime::now();
size_t n = socket_.write_some(buf,e);
booster::ptime end = booster::ptime::now();
// it may actually return with success but return small
// a small buffer
if(booster::ptime::to_number(end - start) >= timeout_ - 0.1) {
e=booster::system::error_code(errc::protocol_violation,cppcms_category);
die();
return n;
}
if(e && (io::basic_socket::would_block(e)
#ifdef CPPCMS_WIN32
|| e.value() == 10060 // WSAETIMEDOUT - do not want to include windows.h
#endif
)
) {
// handle timeout with SO_SNDTIMEO
// that responds with EAGIAN or EWOULDBLOCK
die();
}
return n;
}
#else
size_t timed_write_some(booster::aio::const_buffer const &buf,booster::system::error_code &e)
{
socket_.set_non_blocking_if_needed(true,e);
booster::ptime start = booster::ptime::now();
pollfd pfd=pollfd();
pfd.fd = socket_.native();
pfd.events = POLLOUT;
pfd.revents = 0;
int msec = timeout_ * 1000;
int r = 0;
while((r=poll(&pfd,1,msec))<0 && errno==EINTR) {
msec -= booster::ptime::milliseconds(booster::ptime::now() - start);
if(msec <= 0) {
r = 0;
break;
}
}
if(r < 0) {
e=booster::system::error_code(errno,booster::system::system_category);
return 0;
}
if(r==1 && pfd.revents & POLLOUT)
return socket_.write_some(buf,e);
e=booster::system::error_code(errc::protocol_violation,cppcms_category);
die();
return 0;
}
#endif
bool write_to_socket(booster::aio::const_buffer const &bufin,booster::system::error_code &e)
{
booster::aio::const_buffer buf = bufin;
size_t total = 0;
while(!buf.empty()) {
size_t n = timed_write_some(buf,e);
total += n;
buf += n;
if(e) {
close();
break;
}
}
return total == bufin.bytes_count();
}
virtual booster::aio::io_service &get_io_service()
{
return socket_.get_io_service();
}
virtual bool keep_alive()
{
return false;
}
void close()
{
booster::system::error_code e;
socket_.shutdown(io::stream_socket::shut_rdwr,e);
socket_.close(e);
}
struct ignore_binder {
callback h;
void operator()(booster::system::error_code const &,size_t) { h(); }
};
virtual void async_read_eof(callback const &h)
{
watchdog_->add(self());
static char a;
ignore_binder cb = { h };
socket_.async_read_some(io::buffer(&a,1),cb);
}
void on_async_write_start()
{
update_time();
watchdog_->add(self());
}
void on_async_write_progress(bool completed)
{
update_time();
if(completed)
watchdog_->remove(self());
}
virtual booster::aio::stream_socket &socket() { return socket_; }
virtual booster::aio::const_buffer format_output(booster::aio::const_buffer const &in,bool /*completed*/,booster::system::error_code &e)
{
if(headers_done_)
return in;
booster::aio::const_buffer packet;
std::pair<booster::aio::const_buffer::entry const *,size_t> tmp = in.get();
booster::aio::const_buffer::entry const *entry = tmp.first;
size_t parts = tmp.second;
output_pbase_=output_pptr_=output_epptr_=0;
bool r=false;
while(parts > 0) {
output_pbase_=static_cast<char const *>(entry->ptr);
output_pptr_ = output_pbase_;
output_epptr_ = output_pbase_ + entry->size;
r =process_output_headers(e);
parts--;
entry++;
if(r) {
if(!e)
headers_done_ = true;
break;
}
}
if(e)
return packet;
if(!r) {
tmp = in.get();
entry = tmp.first;
parts = tmp.second;
output_body_.reserve(output_body_.size() + in.bytes_count());
while(parts > 0) {
output_body_.insert(output_body_.end(),entry->ptr,entry->ptr+entry->size);
parts--;
entry++;
}
return packet;
}
packet+= booster::aio::buffer(response_line_);
if(!output_body_.empty())
packet+= booster::aio::buffer(output_body_);
packet+= in;
return packet;
}
private:
bool process_output_headers(booster::system::error_code &e)
{
static char const *addon =
"Server: CppCMS-Embedded/" CPPCMS_PACKAGE_VERSION "\r\n"
"Connection: close\r\n";
using cppcms::http::impl::parser;
for(;;) {
switch(output_parser_.step()) {
case parser::more_data:
return false;
case parser::got_header:
{
char const *name="";
char const *value="";
if(!parse_single_header(output_parser_.header_,name,value)) {
e=booster::system::error_code(errc::protocol_violation,cppcms_category);
return true;
}
if(strcmp(name,"STATUS")==0) {
response_line_ = "HTTP/1.0 ";
response_line_ +=value;
response_line_ +="\r\n";
response_line_.append(addon);
return true;
}
}
break;
case parser::end_of_headers:
response_line_ = "HTTP/1.0 200 Ok\r\n";
response_line_.append(addon);
return true;
case parser::error_observerd:
e=booster::system::error_code(errc::protocol_violation,cppcms_category);
return true;
}
}
}
void process_request(handler const &h)
{
char const *rm = request_method_;
char const *rm_end = request_method_ + strlen(request_method_);
if(rm==rm_end || cppcms::http::protocol::tocken(rm,rm_end)!=rm_end) {
error_response("HTTP/1.0 400 Bad Request\r\n\r\n",h);
return;
}
env_.add("REQUEST_METHOD",request_method_);
if(rewrite_)
request_uri_ = rewrite_->rewrite(request_uri_,pool_);
char const *remote_addr=0;
if(service().cached_settings().http.proxy.behind==true) {
std::vector<std::string> const &variables =
service().cached_settings().http.proxy.remote_addr_cgi_variables;
for(unsigned i=0;remote_addr == 0 && i<variables.size();i++) {
remote_addr = env_.get(variables[i].c_str());
}
}
if(!remote_addr) {
booster::system::error_code e;
remote_addr=pool_.add(socket_.remote_endpoint(e).ip());
if(e) {
close();
h(e);
return;
}
}
env_.add("REMOTE_HOST",remote_addr);
env_.add("REMOTE_ADDR",remote_addr);
if(request_uri_[0]!='/') {
error_response("HTTP/1.0 400 Bad Request\r\n\r\n",h);
return;
}
char *path=non_const_empty_string;
char *query = strchr(request_uri_,'?');
if(query == 0) {
path=request_uri_;
}
else {
path=pool_.add(request_uri_,query - request_uri_);
env_.add("QUERY_STRING",query + 1);
}
std::vector<std::string> const &script_names =
service().cached_settings().http.script_names;
size_t path_size = strlen(path);
for(unsigned i=0;i<script_names.size();i++) {
std::string const &name=script_names[i];
size_t name_size = name.size();
if(path_size >= name_size && memcmp(path,name.c_str(),name_size) == 0
&& (path_size == name_size || path[name_size]=='/'))
{
env_.add("SCRIPT_NAME",pool_.add(name));
path = path + name_size;
break;
}
}
env_.add("PATH_INFO",pool_.add(util::urldecode(path,path+strlen(path))));
update_time();
h(booster::system::error_code());
}
void on_async_read_complete()
{
remove_from_watchdog();
}
void error_response(char const *message,handler const &h)
{
socket_.async_write(io::buffer(message,strlen(message)),
mfunc_to_io_handler(&http::on_error_response_written,self(),h));
}
void on_error_response_written(booster::system::error_code const &e,size_t,handler const &h)
{
if(e) {
h(e);
return;
}
close();
h(booster::system::error_code(errc::protocol_violation,cppcms_category));
}
bool parse_single_header(std::string const &header,char const *&o_name,char const *&o_value)
{
char const *p=header.c_str();
char const *e=p + header.size();
char const *name_end = p;
p=cppcms::http::protocol::skip_ws(p,e);
name_end=cppcms::http::protocol::tocken(p,e);
if(name_end==p)
return false;
size_t name_size = name_end - p;
char *name = pool_.alloc(name_size + 1);
*std::copy(p,name_end,name) = 0;
p=name_end;
p=cppcms::http::protocol::skip_ws(p,e);
if(p==e || *p!=':')
return false;
++p;
p=cppcms::http::protocol::skip_ws(p,e);
char *value = pool_.alloc(e-p+1);
*std::copy(p,e,value) = 0;
for(unsigned i=0;i<name_size;i++) {
if(name[i] == '-')
name[i]='_';
else if('a' <= name[i] && name[i] <='z')
name[i]=name[i]-'a' + 'A';
}
o_name = name;
o_value = value;
return true;
}
booster::shared_ptr<http> self()
{
return booster::static_pointer_cast<http>(shared_from_this());
}
friend class socket_acceptor<http,http_creator>;
booster::aio::stream_socket socket_;
std::vector<char> input_body_;
unsigned input_body_ptr_;
::cppcms::http::impl::parser input_parser_;
std::vector<char> output_body_;
char const *output_pbase_;
char const *output_pptr_;
char const *output_epptr_;
::cppcms::http::impl::parser output_parser_;
std::string response_line_;
char *request_method_;
char *request_uri_;
bool headers_done_;
bool first_header_observerd_;
unsigned total_read_;
time_t time_to_die_;
int timeout_;
bool sync_option_is_set_;
bool in_watchdog_;
void add_to_watchdog()
{
if(!in_watchdog_) {
watchdog_->add(self());
in_watchdog_ = true;
}
}
void remove_from_watchdog()
{
if(in_watchdog_) {
watchdog_->remove(self());
in_watchdog_ = false;
}
}
booster::shared_ptr<http_watchdog> watchdog_;
booster::shared_ptr<url_rewriter> rewrite_;
bool eof_callback_;
};
void http_watchdog::check(booster::system::error_code const &e)
{
if(e)
return;
std::list<http_ptr> kill;
time_t now = time(0);
for(connections_type::iterator p=connections_.begin(),e=connections_.end();p!=e;) {
booster::shared_ptr<http> ptr = p->lock();
if(!ptr) {
connections_type::iterator tmp = p;
++p;
connections_.erase(tmp);
}
else {
if(ptr->time_to_die() < now) {
kill.push_back(ptr);
connections_type::iterator tmp = p;
++p;
connections_.erase(tmp);
}
else {
++p;
}
}
}
for(std::list<http_ptr>::iterator p=kill.begin();p!=kill.end();++p) {
(*p)->async_die();
}
timer_.expires_from_now(booster::ptime(1));
timer_.async_wait(mfunc_to_event_handler(&http_watchdog::check,shared_from_this()));
}
http *http_creator::operator()(cppcms::service &srv) const
{
return new http(srv,ip_,port_,watchdog_,rewrite_);
}
std::auto_ptr<acceptor> http_api_factory(cppcms::service &srv,std::string ip,int port,int backlog)
{
typedef socket_acceptor<http,http_creator> acceptor_type;
std::auto_ptr<acceptor_type> acc(new acceptor_type(srv,ip,port,backlog));
acc->factory(http_creator(srv.get_io_service(),srv.settings(),ip,port));
std::auto_ptr<acceptor> a(acc);
return a;
}
} // cgi
} // impl
} // cppcms
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

CppCMS Framework
暂无标签
MIT
使用 MIT 开源许可协议
, MIT
使用 MIT 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yyxtyk/cppcms.git
git@gitee.com:yyxtyk/cppcms.git
yyxtyk
cppcms
cppcms
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /