Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
deanberris merged 4 commits intocpp-netlib:0.11-develfromrubu:0.11-devel
Dec 5, 2013
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Updated header parser test case, removed duplicate status code
  • Loading branch information
Rudolfs Bundulis committedDec 4, 2013
commit564cafab2cc0eab95753b7548f4c7ce38dc26649
1 change: 0 additions & 1 deletionboost/network/protocol/http/impl/response.ipp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,7 +53,6 @@ namespace boost { namespace network { namespace http {
temporary_redirect = 307,
bad_request = 400,
unauthorized = 401,
forbidden = 403,
payment_required = 402,
forbidden = 403,
not_found = 404,
Expand Down
23 changes: 14 additions & 9 deletionslibs/network/test/http/server_header_parser_test.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@
#include <boost/network/protocol/http/server.hpp>
#include <boost/config/warning_disable.hpp>
#include <boost/test/unit_test.hpp>
#define BOOST_LOCALE_NO_LIB
#include <boost/locale/encoding.hpp>
#include <string>
#include <iostream>

Expand All@@ -26,17 +28,20 @@ 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::wstring utf16_test_name = L"R\u016bdolfs";
request_header_narrow utf8_header = { "X-Utf8-Test-Header", boost::locale::conv::utf_to_utf<char>(utf16_test_name) };
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)
std::vector<request_header_narrow>::iterator header_iterator = headers.begin();
for(; header_iterator != headers.end(); ++ header_iterator)
{
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;
}
if (header_iterator->name == utf8_header.name && header_iterator->value == utf8_header.value)
break;
}
std::wstring utf16_test_name_from_header = boost::locale::conv::utf_to_utf<wchar_t>(header_iterator->value);
BOOST_CHECK(header_iterator != headers.end());
BOOST_CHECK(utf16_test_name_from_header == utf16_test_name);
std::cout << "utf8 header parsed, name: " << header_iterator->name << ", value: " << header_iterator->value;
}

[8]ページ先頭

©2009-2025 Movatter.jp