这是问题.
给定url http://www.example.com,我们可以从页面中读取前N个字节吗?
>使用wget,我们可以下载整个页面.
>使用curl,有-r,0-499指定前500个字节.似乎解决了这个问题.
You should also be aware that many HTTP/1.1 servers do not have this feature enabled,so that when you attempt to get a range,you’ll instead get the whole document.
>在python中使用urlib.类似的问题here,但根据康斯坦丁的评论,这是真的吗?
Last time I tried this technique it Failed because it was actually impossible to read from the HTTP server only specified amount of data,i.e. you implicitly read all HTTP response and only then read first N bytes out of it. So at the end you ended up downloading the whole 1Gb malicIoUs response.
那么问题是我们如何从HTTP服务器上读取第一个N个字节呢?
问候与谢谢
解决方法
curl <url> | head -c 499
要么
curl <url> | dd count=499
应该做
还有一个比较简单的utils可能是borader的可用性
netcat host 80 <<"HERE" | dd count=499 of=output.fragment GET /urlpath/query?string=more&bloddy=stuff HERE
要么
GET /urlpath/query?string=more&bloddy=stuff