From eb7e971c7a1429a9568b4ec5a3f66b0e75326103 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 15 Jun 2017 06:55:43 -0700 Subject: [PATCH] Renamed to basic_fields::set (API Change): * `replace` is renamed to `set` Actions Required: * Rename calls to `basic_fields::replace` to `basic_fields::set` --- CHANGELOG.md | 8 ++++++++ example/doc/http_examples.hpp | 2 +- include/beast/http/fields.hpp | 8 ++++---- include/beast/http/impl/fields.ipp | 6 +++--- include/beast/websocket/detail/pmd_extension.hpp | 4 ++-- test/http/doc_examples.cpp | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f953191..4c74038c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ Version 58: * Reorganize examples * Specification for http read +API Changes: + +* `basic_fields::set` renamed from `basic_fields::replace` + +Actions Required: + +* Rename calls to `basic_fields::replace` to `basic_fields::set` + -------------------------------------------------------------------------------- Version 57: diff --git a/example/doc/http_examples.hpp b/example/doc/http_examples.hpp index f1add098..d1aefdfd 100644 --- a/example/doc/http_examples.hpp +++ b/example/doc/http_examples.hpp @@ -62,7 +62,7 @@ send_expect_100_continue( "DynamicBuffer requirements not met"); // Insert or replace the Expect field - req.replace(field::expect, "100-continue"); + req.set(field::expect, "100-continue"); // Create the serializer auto sr = make_serializer(req); diff --git a/include/beast/http/fields.hpp b/include/beast/http/fields.hpp index ff98d160..3a29bf8f 100644 --- a/include/beast/http/fields.hpp +++ b/include/beast/http/fields.hpp @@ -390,7 +390,7 @@ public: insert(field name, string_view name_string, string_param const& value); - /** Replace a field value. + /** Set a field value, removing any other instances of that field. First removes any values with matching field names, then inserts the new field value. @@ -402,9 +402,9 @@ public: @return The field value. */ void - replace(field name, string_param const& value); + set(field name, string_param const& value); - /** Replace a field value. + /** Set a field value, removing any other instances of that field. First removes any values with matching field names, then inserts the new field value. @@ -414,7 +414,7 @@ public: @param value The value of the field, as a @ref string_param */ void - replace(string_view name, string_param const& value); + set(string_view name, string_param const& value); /** Remove a field. diff --git a/include/beast/http/impl/fields.ipp b/include/beast/http/impl/fields.ipp index dac9c54d..7c5467a7 100644 --- a/include/beast/http/impl/fields.ipp +++ b/include/beast/http/impl/fields.ipp @@ -508,7 +508,7 @@ insert(field name, template void basic_fields:: -replace(field name, string_param const& value) +set(field name, string_param const& value) { BOOST_ASSERT(name != field::unknown); erase(name); @@ -518,7 +518,7 @@ replace(field name, string_param const& value) template void basic_fields:: -replace(string_view sname, string_param const& value) +set(string_view sname, string_param const& value) { auto const name = string_to_field(sname); erase(sname); @@ -780,7 +780,7 @@ set_chunked_impl(bool v) if(it == end()) this->insert(field::transfer_encoding, "chunked"); else - this->replace(field::transfer_encoding, + this->set(field::transfer_encoding, it->value().to_string() + ", chunked"); } diff --git a/include/beast/websocket/detail/pmd_extension.hpp b/include/beast/websocket/detail/pmd_extension.hpp index f6ee68de..a4f62079 100644 --- a/include/beast/websocket/detail/pmd_extension.hpp +++ b/include/beast/websocket/detail/pmd_extension.hpp @@ -236,7 +236,7 @@ pmd_write(Fields& fields, pmd_offer const& offer) { s += "; client_no_context_takeover"; } - fields.replace("Sec-WebSocket-Extensions", s); + fields.set(http::field::sec_websocket_extensions, s); } // Negotiate a permessage-deflate client offer @@ -329,7 +329,7 @@ pmd_negotiate( break; } if(config.accept) - fields.replace("Sec-WebSocket-Extensions", s); + fields.set(http::field::sec_websocket_extensions, s); } // Normalize the server's response diff --git a/test/http/doc_examples.cpp b/test/http/doc_examples.cpp index d1900e8f..3b780d30 100644 --- a/test/http/doc_examples.cpp +++ b/test/http/doc_examples.cpp @@ -124,7 +124,7 @@ public: { ec = {}; h.erase("Content-Length"); - h.replace("Transfer-Encoding", "chunked"); + h.set("Transfer-Encoding", "chunked"); }); BEAST_EXPECTS(! ec, ec.message()); BEAST_EXPECT(equal_body(