-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
对http协议格式的分析 #63
Comments
这个结果很有意思,getStrFromDecFromHex('0d')和getStrFromDecFromHex('0a')不同含义。 经过gzip压缩过, |
getDecFromHex(["1f", "8b", "08", "00", "00", "00", "00", "00", "00", "03", "f3", "48", "cd", "c9", "c9", "57", "08", "cf", "2f", "ca", "49", "51", "04", "00", "a3", "1c", "29", "1c", "0c", "00", "00", "00"]) |
我总算明白了一个现象,
这个buf和a根本不是相同的,坑了坑了 ,果然对Buffer理解不到位坑我了 |
对于gzip内容的分析,现在我只能通过字符串的ASCII码来判断。
|
按照ecmascript中string的split的大概意思模仿出了一个分割数组方法。
|
参考fiddler的文件替换的首部, 123
|
在http首部中,有Content-Length属性,它标识body体的长度,但是这个长度不是body体字符串的长度,而是字节的长度,在nodejs中即将字符串转化为buffer流的length,如果body的字节长度小于length,则客户端继续等待数据;如果大于length,则浏览器截取length长度的数据。 参考: |
走socks看到报文内容,
我们写一个程序分析下,这个涉及node buffer的有关二进制 unicode的处理,这个方面我还要加强下,还是有点了解的不通透。
输出内容:
我一直不理解这个c和0是什么意思。尤其是gzip传输的内容,我还是无法理解,按照我的想法,response body体内直接是内容,Hello World就足够了 ,为什么还多了几个字节???
其实reponse body体内,是
对应文本:
将该文本转化为字符串,为
"c\r\nHello World\n\r\n0"
再转化为二进制,
结果是
[99, 13, 10, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 10, 13, 10, 48]
将上面的数组a按照http格式排下序,
用到的方法:
对应wireshark可以看到,
在《HTTP权威指南》第3.2章有这样一句话,
这个CRLF就是上面一张图挂在最后的两个16进制数据(0d 0a),我们对\r\d来进行分析,
string2unicode('\r\n')结果是[13, 10]
getHexFromNum([13,10])结果是["d", "a"].分析结束
The text was updated successfully, but these errors were encountered: