V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
thomaswang
V2EX  ›  问与答

http 响应报文

  •  
  •   thomaswang · Mar 14, 2018 · 1946 views
    This topic created in 2967 days ago, the information mentioned may be changed or developed.
    char response[] = "HTTP/1.1 200 OK\r\nKeep-Alive: 2\r\nContent-Length:14\r\nContent-Type: text/html\r\n\r\n<h1>nihao</h1>";
    write(*connect_sock, response, sizeof(response));
    

    我在写服务端软件,响应 http 请求,我构建一个简单的 http 响应报文,chrome 可以查看,postman 不能显示,我还需要添加点什么才能让 postman 显示呢

    QQ20180314-171122.png

    QQ20180314-171155.png

    9 replies    2018-03-16 19:51:47 +08:00
    carlclone
        1
    carlclone  
       Mar 14, 2018
    http:// ?
    b821025551b
        2
    b821025551b  
       Mar 14, 2018
    这个是插件版的 postman 还是 app 版的?是不是走代理了
    chairuosen
        3
    chairuosen  
       Mar 14, 2018
    用 curl --verbose 试
    thomaswang
        4
    thomaswang  
    OP
       Mar 14, 2018
    @carlclone 对的
    thomaswang
        5
    thomaswang  
    OP
       Mar 14, 2018
    @b821025551b 没有,这个应该是我的响应报文缺少信息,postman 认为是一个不合法的响应
    thomaswang
        6
    thomaswang  
    OP
       Mar 14, 2018
    @chairuosen 想用 postman,图个方便
    chairuosen
        7
    chairuosen  
       Mar 14, 2018
    @thomaswang postman 不是没法显示么,你用 curl 对比你的和正常的结果有什么不同
    sunjourney
        8
    sunjourney  
       Mar 14, 2018
    http 协议最重要的 method 呢? 这个 keep-alive 用的太生僻了吧,一般是 Connection: Keep-Alive
    katsusan
        9
    katsusan  
       Mar 16, 2018 via iPhone
    看你 postman 里 body 是灰的,是不是 headers 和 body 的解析有问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   986 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 19:30 · PVG 03:30 · LAX 12:30 · JFK 15:30
    ♥ Do have faith in what you're doing.