您当前的位置: 首页 >  http

qianbo_insist

暂无认证

  • 0浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

c++ 实现http get 和 post

qianbo_insist 发布时间:2022-08-02 17:08:32 ,浏览量:0

实现http协议

使用boost asio 去实现client,代码比较简单,熟悉http协议就行,这样得好处是至少不用包含很多第三方库,且也可以使用asio 直接实现。这个我已经实验过了,没有问题

#pragma once
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include 
#include 
#include 
#include 
#include 
#include 
using namespace boost;
using asio::ip::tcp;
using std::string;

//这里直接搜索http的头部字符串

static size_t split_httphead(const std::string str, std::string &k, std::string &v)
{
	size_t pos = -1;
	for (size_t i = 0; i             
关注
打赏
1663161521
查看更多评论
0.0433s