ZLMediaKit/src/Http/HttpRequestSplitter.h

50 lines
1.1 KiB
C
Raw Normal View History

//
// Created by xzl on 2018/9/20.
//
#ifndef ZLMEDIAKIT_HTTPREQUESTSPLITTER_H
#define ZLMEDIAKIT_HTTPREQUESTSPLITTER_H
#include <string>
using namespace std;
class HttpRequestSplitter {
public:
HttpRequestSplitter(){};
virtual ~HttpRequestSplitter(){};
/**
*
* @param data
*/
void input(const string &data);
protected:
/**
*
* @param header
* @return content长度,
* <0 : content
* 0 : ,
* >0 : content,
*/
virtual int64_t onRecvHeader(const string &header) = 0;
/**
* content分片或全部数据
* onRecvHeader函数返回>0,
* @param content
*/
virtual void onRecvContent(const string &content) = 0;
2018-09-21 09:41:40 +08:00
/**
* content len
*/
void setContentLen(int64_t content_len);
private:
string _remain_data;
int64_t _content_len = 0;
};
#endif //ZLMEDIAKIT_HTTPREQUESTSPLITTER_H