本文介绍了可以使用Linux命令从HTTP服务器只读取前N个字节吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是问题。



给定网址 http://www.example.com ,我们可以读取前N个字节通过使用 wget ,我们可以下载整个网页。 $ b $ b

  • 使用 curl ,有-r,0-499指定前500个字节。似乎解决了这个问题。


  • 使用 urlib 在python中。类似问题,但根据Konstantin的评论,是真的吗?




  • 因此,问题是我们如何在实践中从HTTP服务器读取前N个字节?



    感谢

    解决方案
      curl< url& | head -c 499 

      curl< url> | dd count = 499 

    应该



    也有更简单的工具可能borader可用性如

      netcat host 80<HERE| dd count = 499 of = output.fragment 
    GET / urlpath / query?string = more& bloddy = stuff

    此处

      GET / urlpath / query?string = more& bloddy = stuff 


    Here is the question.

    Given the url http://www.example.com, can we read the first N bytes out of the page?

    • using wget, we can download the whole page.
    • using curl, there is -r, 0-499 specifies the first 500 bytes. Seems solve the problem.

    • using urlib in python. similar question here, but according to Konstantin's comment, is that really true?

    So the problem is that how can we read the first N bytes from the HTTP server in practice?

    Regards & Thanks

    解决方案
    curl <url> | head -c 499
    

    or

    curl <url> | dd count=499
    

    should do

    Also there are simpler utils with perhaps borader availability like

        netcat host 80 <<"HERE" | dd count=499 of=output.fragment
    GET /urlpath/query?string=more&bloddy=stuff
    
    HERE
    

    Or

    GET /urlpath/query?string=more&bloddy=stuff
    

    这篇关于可以使用Linux命令从HTTP服务器只读取前N个字节吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-05 17:21
    查看更多