Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Beast includes CRLF in HTTP fields
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-07-07 15:20:34


On Sat, Jul 7, 2018 at 8:11 AM, David Demelier via Boost-users
<boost-users_at_[hidden]> wrote:
> The res_ object is a http::response<http::string_body>, And once
> printed to the console I have:
>
> new location: [http://www.google.fr/
> ]

Hmm...that's not what I'm seeing. I added this function to
test/beast/http/fields.cpp:

    void
    testValue()
    {
        request<empty_body> req;
        req.insert(field::location, "http://www.google.fr/");
        auto it = req.find(field::location);
        if(it != req.end())
            log << "[" << it->value() << "]";
    }

The output is:

    beast.http.fields
    [http://www.google.fr/]25.6s, 1 suite, 1 case, 334 tests total, 0 failures
    The program '[0x6BF4] tests-beast-http.exe' has exited with code 0 (0x0).

If the CRLF was being included in the value, then none of these tests
would pass, as the equalities would evaluate to false:

<https://github.com/boostorg/beast/blob/1a008faf0ab99b90ac64595164fd34f11af72cce/test/beast/http/fields.cpp#L965>

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net