- Notifications
You must be signed in to change notification settings - Fork425
Support Utf8 characters in the asynchronous connection header parser#341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
…me/value parser grammar
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright 2010 Dean Michael Berris. | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. So technically, this isn't my copyright as you're the author of this code. Please update properly. | ||
| // Distributed under the Boost Software License, Version 1.0. | ||
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
| #define BOOST_TEST_MODULE HTTP Server Header Parser Test | ||
| #include <boost/network/protocol/http/server.hpp> | ||
| #include <boost/config/warning_disable.hpp> | ||
| #include <boost/test/unit_test.hpp> | ||
| #include <string> | ||
| #include <iostream> | ||
| /** Synopsis | ||
| * | ||
| * Test for Utf8 support in the asynchronous connection header parser | ||
| * -------------------------------------------- | ||
| * | ||
| * This test checks for Utf8 support in the header parser | ||
| * for asynchronous connection | ||
| * | ||
| */ | ||
| namespace tags = boost::network::tags; | ||
| namespace logic = boost::logic; | ||
| namespace fusion = boost::fusion; | ||
| using namespace boost::network::http; | ||
| BOOST_AUTO_TEST_CASE(async_connection_parse_headers) { | ||
| request_header_narrow utf8_header = { "X-Utf8-Test-Header", "R\uc5abdolfs" }; | ||
| std::string valid_http_request; | ||
| valid_http_request.append(utf8_header.name).append(": ").append(utf8_header.value).append("\r\n\r\n"); | ||
| std::vector<request_header_narrow> headers; | ||
| parse_headers(valid_http_request, headers); | ||
| std::vector<request_header_narrow>::iterator utf8_header_iterator = std::find_if(headers.begin(), headers.end(), [&utf8_header, &utf8_header_iterator](request_header_narrow& header) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Unfortunately, 0.11.0 can't use C++11 features -- we reserve any C++11 support for 1.x releases (on master). Can you make this work without C++11 language support? Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. ahh yeah, sure, i'll rewrite that, sorry that i didn't take that into 2013/12/4 Dean Michael Berrisnotifications@github.com
Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. hi, sorry for the mess with the PR's, first time and still getting familiar 2013/12/4 Rûdolfs Bundulisrudolfs.bundulis@gmail.com
| ||
| { | ||
| if (header.name == utf8_header.name && header.value == utf8_header.value) | ||
| return true; | ||
| return false; | ||
| }); | ||
| BOOST_CHECK(utf8_header_iterator != headers.end()); | ||
| std::cout << "utf8 header parsed, name: " << utf8_header_iterator->name << ", value: " << utf8_header_iterator->value << std::endl; | ||
| } | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Please add a newline at the end of the file. | ||