Sample
Encoded response
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
25
This is the data in the first chunk
1A
and this is the second one
0
same as above, raw bytes
in hex
0000-000F 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010-001F 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 .Content-Type: t
0020-002F 65 78 74 2f 70 6c 61 69 6e 0d 0a 54 72 61 6e 73 ext/plain..Trans
0030-003F 66 65 72 2d 45 6e 63 6f 64 69 6e 67 3a 20 63 68 fer-Encoding: ch
0040-004F 75 6e 6b 65 64 0d 0a 0d 0a 32 35 0d 0a 54 68 69 unked....25..Thi
0050-005F 73 20 69 73 20 74 68 65 20 64 61 74 61 20 69 6e s is the data in
0060-006F 20 74 68 65 20 66 69 72 73 74 20 63 68 75 6e 6b the first chunk
0070-007F 0d 0a 0d 0a 31 41 0d 0a 61 6e 64 20 74 68 69 73 ....1A..and this
0080-008F 20 69 73 20 74 68 65 20 73 65 63 6f 6e 64 20 6f is the second o
0090-009F 6e 65 0d 0a 30 0d 0a 0d 0a ne..0....
same as above, in Java code
public static final byte[] CHUNKED_RESPONSE;
static {
StringBuilder sb = new StringBuilder();
sb.append("HTTP/1.1 200 OK\r\n");
sb.append("Content-Type: text/plain\r\n");
sb.append("Transfer-Encoding: chunked\r\n\r\n");
sb.append("25\r\n");
sb.append("This is the data in the first chunk\r\n"); // 37 bytes of payload
// (conveniently consisting of ASCII characters only)
sb.append("\r\n1A\r\n");
sb.append("and this is the second one"); // 26 bytes of payload
// (conveniently consisting of ASCII characters only)
sb.append("\r\n0\r\n\r\n");
CHUNKED_RESPONSE = sb.toString().getBytes(java.nio.charset.Charset.forName("US-ASCII"));
}
Decoded data
This is the data in the first chunk
and this is the second one
基本上checked的编码方式。
相关推荐
HTTP协议的chunked编码
一个对chunked编码进行解码的例子,通过java socket实现发送http请求,对gzip压缩的消息体进行解码处理。
一个用C语言实现的解析HTTP chunked方式传输的数据包的演示程序
有时候,Web服务器生成HTTP Response是无法在Header就确定消息大小的,这时一般来说服务器将不会提供Content-Length的头信息,而采用Chunked编码动态的提供body内容的长度。
Chunk Scatter 是一个用来在线分析 HTTP Chunked 编码的工具。 标签:Chunk
傲游浏览器Mac版包括以下主要特性: ... 阅读模式:全新阅读给用户带来舒适的阅读体验,远离诸多视觉干扰。...* 文件下载_HTTP chunked 编码格式时,下载进度未正常显示 * 已知的bug问题 傲游浏览器mac版截图
3.6.1块传输编码(Chunked Transfer Coding) 3.7 媒体类型(Media Type) 3.7.1规范化和文本缺省 (Canonicalization and Text Defaults) 3.7.2多部分类型(Multipart type) 3.8 产品标记 (product Tokens) 3.9...
3.6.1块传输编码(Chunked Transfer Coding) 25 3.7 媒体类型(Media Type) 27 3.7.1规范化和文本缺省 27 3.7.2多部分类型(Multipart type) 28 3.8 产品标记 (product Tokens) 29 3.9 质量值(Quality Values...
1.1支持长连接(Persistent connections) 1.1支持分块编码(chunked-encoding) 1.1支持缓存 1.1支持压缩和解压缩
一般大家在处理这种情况,都使用ajax,先把html输出到... 分块编码(chunked encoding) chunked encoding 是http1.1 才支持编码格式(当然目前没有哪个浏览器不支持1.1了),chunked encoding 与一般的响应区别如下:
分块传输编码(Chunked transfer encoding)是超文本传输协议(HTTP)中的一种数据传输机制,允许HTTP由应用服务器发送给客户端应用
高级java笔试题 ...chunked 编码插入 gzip压缩的数据缓存解压后再进行插入 tcp/ip首部校验,判断是否为坏包 说点没用的,没兴趣可直接跳过 (自认为)代码写完了,狗啃的一样,屎一样的代码,而且没
◆ 123.htm 自动更新工作站的应用程序 ◆ 124.htm 自己的IE——用VB制作器 ◆ 125.htm HTTP协议(学习笔记) ◆ 126.htm HTTP协议四--关于Chunked编码 ◆ 127.htm IE器完全控制 ◆ ...