|
Boost Users : |
Subject: Re: [Boost-users] Boost.Beast includes CRLF in HTTP fields
From: David Demelier (markand_at_[hidden])
Date: 2018-07-07 15:34:10
On Sat, 2018-07-07 at 08:20 -0700, Vinnie Falco via Boost-users wrote:
> 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:
My bad, I apologize I wrongly converted the boost::string_view to
std::string using the .data() member function and I just realized it's
not null terminated... That's why my string was filled with random
characters.
Sorry for the noise!
I should search how people convert boost::string_view to std::string in
a convenient manner instead ;)
Regards,
-- David
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