zoukankan      html  css  js  c++  java
  • http://tools.ietf.org/html/rfc7231#section-8.1.3,

    mg_http_parse_headers(s, end, hm->headers,
    sizeof(hm->headers) / sizeof(hm->headers[0]));
    if ((cl = mg_http_get_header(hm, "Content-Length")) != NULL) {
    hm->body.len = (size_t) mg_to64(*cl);
    hm->message.len = req_len + hm->body.len;
    }

    // mg_http_parse() is used to parse both HTTP requests and HTTP
    // responses. If HTTP response does not have Content-Length set, then
    // body is read until socket is closed, i.e. body.len is infinite (~0).
    //
    // For HTTP requests though, according to
    // http://tools.ietf.org/html/rfc7231#section-8.1.3,
    // only POST and PUT methods have defined body semantics.
    // Therefore, if Content-Length is not specified and methods are
    // not one of PUT or POST, set body length to 0.
    //
    // So, if it is HTTP request, and Content-Length is not set,
    // and method is not (PUT or POST) then reset body length to zero.
  • 相关阅读:
    帮助智力障碍的可怜儿童
    PE556
    ZJOIDay2T1 BB题解
    CTSC2016游记
    再次被老爸钦点退役
    欧拉筛
    考据
    51nod 1020 逆序排列(动态规划)
    51nod 1186 质数检测(Miller-Rabin算法)
    大整数类模板
  • 原文地址:https://www.cnblogs.com/rsapaper/p/14388401.html
Copyright © 2011-2022 走看看