91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5.13KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-02-22
  • 語言: C/C++
  • 標簽: http??c++??en??TP??ib??

資源簡介

        event_init();
 
        //創建一個http server
        struct evhttp *httpd;
        httpd = evhttp_start(httpd_option_listen, httpd_option_port);
        evhttp_set_timeout(httpd, httpd_option_timeout);
 
        //指定generic callback
        evhttp_set_gencb(httpd, httpd_handler, NULL);
        //也可以為特定的URI指定callback
        //evhttp_set_cb(httpd, "/", specific_handler, NULL);
 
        //循環處理events
        event_dispatch();
 
        evhttp_free(httpd);

資源截圖

代碼片段和文件信息


????#include?
????#include?
????#include??????//for?getopt?fork
????#include??????//for?strcat
????//for?struct?evkeyvalq
????#include?
????#include?
????//for?http
????#include?
????#include?
?
????#define?MYHTTPD_SIGNATURE???“myhttpd?v?0.0.1“
?
????//處理模塊
????void?httpd_handler(struct?evhttp_request?*req?void?*arg)?{
????????char?output[2048]?=?“\0“;
????????char?tmp[1024];
?
????????//獲取客戶端請求的URI(使用evhttp_request_uri或直接req->uri)
????????const?char?*uri;
????????uri?=?evhttp_request_uri(req);
????????sprintf(tmp?“uri=%s\n“?uri);
????????strcat(output?tmp);
?
????????sprintf(tmp?“uri=%s\n“?req->uri);
????????strcat(output?tmp);
????????//decoded?uri
????????char?*decoded_uri;
????????decoded_uri?=?evhttp_decode_uri(uri);
????????sprintf(tmp?“decoded_uri=%s\n“?decoded_uri);
????????strcat(output?tmp);
?
????????//解析URI的參數(即GET方法的參數)
????????struct?evkeyvalq?par

評論

共有 條評論