chunked 是http传输过程中常用的一种分块手段, 这里是对chunked数据的简易处理方法,主要是拼接block, 去掉块大小和回车信息即可
static ResponseStream *rlib_parse_chunk_data(char *lp_chunk_data, intptr_t nsize)
{
auto pstream = new ResponseStream(Utility::round_up_8(nsize));
if (pstream == nullptr) {
return pstream;
} //if
// to small data size, just ignore it
if (nsize < 16){
pstream->Write(lp_chunk_data, nsize);
} else {
// get chunked data size
const int crlf = RLIB_COUNTOF_STR("\r\n");
int block_size = 0;
LPSTR pDataEnd = lp_chunk_data + nsize;
LPSTR pBlockDataBegin = lp_chunk_data, pBlockDataEnd = lp_chunk_data;
while (pBlockDataBegin < pDataEnd) {
pBlockDataEnd = strstr(pBlockDataBegin, "\r\n");
if (pBlockDataEnd == nullptr) {
trace(!"invalid chunked data");
break;
}
//pBlockDataEnd[0] = '\0';
block_size = Int32::TryParse(pBlockD