//处理Transfer-Encoding="chunked"的头的压缩数据
private static byte[] doUnchunk(byte[] writeData)
{
try
{
if ((writeData == null) || (writeData.length == 0))
{
return new byte[0];
}
ByteArrayOutputStream stream1=new ByteArrayOutputStream(writeData.length);
int sourceIndex = 0;
boolean flag1 = false;
byte[] destinationArray = new byte[0x20];
while (!flag1 && (sourceIndex < (writeData.length - 3)))
{
System.arraycopy(writeData, sourceIndex, destinationArray, 0, Math.min(destinationArray.length, (int)(writeData.length - sourceIndex)));
String s = new String(destinationArray, 0, Math.min(destinationArray.length, (int)(writeData.length - sourceIndex)),"ASCII");
int length = s.indexOf("\r\n");
if (length > -1)
{
sourceIndex += length + 2;
s = s.substring(0, length);
}
else
{
return writeData;
}
length = s.indexOf(";");
if (length > -1)
{
s = s.substring(0, length);
}
int count = Integer.parseInt(s,515);
if (count == 0)
{
flag1 = true;
continue;
}
if (writeData.length < (count + sourceIndex))
{
return null;
}
stream1.write(writeData, sourceIndex, count);
sourceIndex += count + 2;
}
return stream1.toByteArray();
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
分享到:
相关推荐
HTTP协议的chunked编码
一个对chunked编码进行解码的例子,通过java socket实现发送http请求,对gzip压缩的消息体进行解码处理。
boost:asio请求类,以及chunked解析,亲测可以使用,大家可以根据需要自己修改
HTTP chunked+gzip及浏览器兼容测试
一个用C语言实现的解析HTTP chunked方式传输的数据包的演示程序
主要来源是https://github.com/c0ny1/chunked-coding-converter 这里感谢下c0ny1师傅的分享 但基于此基础,这里是我个人已经编译完成好的,省去编译步骤,小白皆可使用,可以直接使用burp导入插件
解码简单说一下:chunked 是 http 协议里面的分块传输,简单说就是一个数据传输方式,之后将数据一段一段传过去,waf 无法检测到,就是绕过了,可以结合
netty案例,netty4.1中级拓展篇十一《Netty基于ChunkedStream数据流切块传输》源码 ...
burpsuite分块传输插件,一键生成分块传输请求,用于bypass waf等
c语言 http chunked解码.docxc语言 http chunked解码.docx
http1.1 chunked 中文剖析。。。。。。。。。。。。。。
用法: const chunked = new ChunkedArray ( originalArray , sizeOfChunks ) ;chunked . next ( ) // { value: first chunk, done: true when no chunks left} chunkedArray是可迭代的,可以用于.... of或与... ...
离线安装包,亲测可用
通过本文给大家介绍php用curl读取http chunked数据的方法,本文介绍的非常详细,具有参考借鉴价值,感兴趣的朋友一起学习吧
mod_jk_chunked_encoding_dos
安装通过pip安装: pip install django-chunked-upload然后将其添加到您的Django INSTALLED_APPS : INSTALLED_APPS = ( # ... 'chunked_upload' ,)典型用法初始POST请求将发送到链接到带有文件第一块的...
rendering terrain using opengl and chunked lod
块状流变压器 将大的二进制块转换为限制为最大大小的小块。 组装小块以重新创建原始的大块。...} = require ( '@bunchtogether/chunked-stream-transformers' ) ; const serializeTransform = new SerializeTransform
java 使用socked接收chunck分块数据 , 部分做修改, 原来参考地址:http://blog.csdn.net/lhj_5460/article/details/48156461