GithubHelp home page GithubHelp logo

chttpresponse's Introduction

CHTTPResponse

based on libevent-2.1.12-stable.tar.gz

使用方法

启动和注册路由

web_init();
web_add_service("/dump", dump_request_cb);
web_start(9999);

读写数据

if(!web_read(req, psMsg, 1024 * 1024 * 2)){
    printf("Error web_read\n");
    web_error(req, HTTP_BADREQUEST, 0);
    return;
}

if(!web_write(req, "asdfadf")){
    web_error(req, HTTP_BADREQUEST, 0);
    return;
}

web_put_status(req, 200, "OK");

编译和测试

cd /usr/local/include
mv event2 event2bak
mkdir build
cd build
cmake ..
make
./CHTTPResponse -p 9999 .

注意事项

baks下是还未处理好的文件

chttpresponse's People

Contributors

xiabo0816 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.