ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
tools_curl.cpp File Reference

实现基于libcurl的HTTP GET/POST请求和邮件发送 More...

#include "actor/protocol/nprotocol.h"
#include "tools/tools/tools_curl.h"
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <format>
#include <limits>
#include <thread>

Classes

struct  ngl::tools::mail_payload_state
 邮件载荷传输状态 More...
class  ngl::tools::email_sender
 邮件发送器类 More...

Namespaces

namespace  ngl::tools
 工具函数命名空间。

Functions

std::string ngl::tools::make_request_url (const http_parm &ahttp)
 构建完整的HTTP请求URL
void ngl::tools::test_mail (const char *atitle, const char *acontent, const std::vector< std::pair< std::string, std::string > > &amailvec)
 测试邮件发送功能
void ngl::tools::test_manage_curl ()
 测试HTTP请求功能

Detailed Description

实现基于libcurl的HTTP GET/POST请求和邮件发送

提供以下功能:

  1. 异步HTTP请求(GET/POST),支持HTTP和HTTPS
  2. SMTP邮件发送(通过libcurl SMTP协议)
  3. 请求参数拼接、Header设置、Cookie支持、超时配置
Note
HTTP请求通过工作队列异步处理,回调在工作线程中触发
See also
tools_curl.h, http_parm, mail_param