@@ -145,13 +145,15 @@ class http_headers
145
145
template <typename _t1>
146
146
void add (const key_type& name, const _t1& value)
147
147
{
148
- if (has (name))
148
+ auto printedValue = utility::conversions::details::print_string (value);
149
+ auto & mapVal = m_headers[name];
150
+ if (mapVal.empty ())
149
151
{
150
- m_headers[name]. append ( _XPLATSTR ( " , " )). append ( utility::conversions::details::print_string (value) );
152
+ mapVal = std::move (printedValue );
151
153
}
152
154
else
153
155
{
154
- m_headers[name] = utility::conversions::details::print_string (value );
156
+ mapVal. append ( _XPLATSTR ( " , " )). append ( std::move (printedValue) );
155
157
}
156
158
}
157
159
@@ -212,20 +214,12 @@ class http_headers
212
214
bool match (const key_type &name, _t1 &value) const
213
215
{
214
216
auto iter = m_headers.find (name);
215
- if (iter != m_headers.end ())
216
- {
217
- // Check to see if doesn't have a value.
218
- if (iter->second .empty ())
219
- {
220
- bind_impl (iter->second , value);
221
- return true ;
222
- }
223
- return bind_impl (iter->second , value);
224
- }
225
- else
217
+ if (iter == m_headers.end ())
226
218
{
227
219
return false ;
228
220
}
221
+
222
+ return bind_impl (iter->second , value) || iter->second .empty ();
229
223
}
230
224
231
225
// / <summary>
@@ -311,6 +305,7 @@ class http_headers
311
305
ref = utility::conversions::to_utf16string (text);
312
306
return true ;
313
307
}
308
+
314
309
bool bind_impl (const key_type &text, std::string &ref) const
315
310
{
316
311
ref = utility::conversions::to_utf8string (text);
0 commit comments