header_lws状态在boost http服务器示例中意味着什么?

时间:2013-10-27 20:43:15

标签: http networking boost http-headers boost-asio

阅读boost http服务器示例(请参阅http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/examples/cpp11_examples.html)并在request_parser.cpp文件中,我看到header_lws状态。部分代码如下:

case header_line_start:
if (input == '\r')
{
    state_ = expecting_newline_3;
    return indeterminate;
}
else if (!req.headers.empty() && (input == ' ' || input == '\t'))
{
    state_ = header_lws;
    return indeterminate;
}
else if (!is_char(input) || is_ctl(input) || is_tspecial(input))
{
    return bad;
}
else
{
    req.headers.push_back(header());
    req.headers.back().name.push_back(input);
    state_ = [header_name];
    return indeterminate;
}
case header_lws:
if (input == '\r')
{
    state_ = expecting_newline_2;
    return indeterminate;
}
else if (input == ' ' || input == '\t')
{
    return indeterminate;
}
else if (is_ctl(input))
{
    return bad;
}
else
{
    state_ = header_value;
    req.headers.back().value.push_back(input);
    return indeterminate;
}

在boost http服务器示例中,header_lws状态意味着什么?

1 个答案:

答案 0 :(得分:1)

LWS代表线性空白。您可以在appropriate RFC

中获取有关HTTP标头格式的更多信息