File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -244,10 +244,19 @@ namespace web
244
244
{
245
245
auto encodingCheck = [](int ch)
246
246
{
247
- // Encode '&', ';', and '=' since they are used
248
- // as delimiters in query component.
249
- return ch == ' &' || ch == ' ;' || ch == ' =' || !::web::details::uri_parser::is_query_character (ch)
250
- || ch == ' %' || ch == ' +' ;
247
+ switch (ch)
248
+ {
249
+ // Encode '&', ';', and '=' since they are used
250
+ // as delimiters in query component.
251
+ case ' &' :
252
+ case ' ;' :
253
+ case ' =' :
254
+ case ' %' :
255
+ case ' +' :
256
+ return true ;
257
+ default :
258
+ return !::web::details::uri_parser::is_query_character (ch);
259
+ }
251
260
};
252
261
encodedName = uri::encode_impl (encodedName, encodingCheck);
253
262
encodedValue = uri::encode_impl (encodedValue, encodingCheck);
Original file line number Diff line number Diff line change @@ -321,6 +321,13 @@ TEST(append_query_string)
321
321
VERIFY_ARE_EQUAL (U (" key1=value1&key2=value2&key3=value3&key4=value4&key5=1&key6=val6&key%3D%26%3B=%3D%26%3Bvalue" ), builder.query ());
322
322
}
323
323
324
+ TEST (append_query_string_no_encode)
325
+ {
326
+ uri_builder builder;
327
+ builder.append_query (U (" key=&;" ), U (" =&;value" ), false );
328
+ VERIFY_ARE_EQUAL (U (" key=&;==&;value" ), builder.query ());
329
+ }
330
+
324
331
TEST (append_string)
325
332
{
326
333
// with just path
You can’t perform that action at this time.
0 commit comments