Skip to content

Commit a87998a

Browse files
committed
fix(params): correct decoded_size in params_iter_impl::decrement() for values containing '='
fix #972
1 parent 60c281a commit a87998a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

include/boost/url/detail/impl/params_iter_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ decrement() noexcept
203203
{
204204
// value
205205
nv = p1 - p; // with '='
206-
dv += dk;
207-
dk = 0;
206+
dv += dk - 1;
207+
dk = 1;
208208
}
209209
else if(*p == '%')
210210
{

test/unit/params_base.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ struct params_base_test
366366
check( "?first=John&last=Doe", { { "first", "John" }, { "last", "Doe" } } );
367367
check( "?key=value&", { { "key", "value" }, {} } );
368368
check( "?&key=value", { {}, { "key", "value" } } );
369+
check( "?a=b=c", { { "a", "b=c" } } );
370+
check( "?k=v=w&x=y", { { "k", "v=w" }, { "x", "y" } } );
371+
check( "?x=y&k=v=w", { { "x", "y" }, { "k", "v=w" } } );
372+
check( "?a=b=c=d", { { "a", "b=c=d" } } );
373+
check( "?===", { { "", "==" } } );
374+
check( "?a==b", { { "a", "=b" } } );
375+
check( "?a=1&b=2=3&c=4", { { "a", "1" }, { "b", "2=3" }, { "c", "4" } } );
369376
}
370377

371378
void

test/unit/params_encoded_base.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ struct params_encoded_base_test
364364
check( "?first=John&last=Doe", { { "first", "John" }, { "last", "Doe" } } );
365365
check( "?key=value&", { { "key", "value" }, {} } );
366366
check( "?&key=value", { {}, { "key", "value" } } );
367+
check( "?a=b=c", { { "a", "b=c" } } );
368+
check( "?k=v=w&x=y", { { "k", "v=w" }, { "x", "y" } } );
369+
check( "?x=y&k=v=w", { { "x", "y" }, { "k", "v=w" } } );
370+
check( "?a=b=c=d", { { "a", "b=c=d" } } );
371+
check( "?===", { { "", "==" } } );
372+
check( "?a==b", { { "a", "=b" } } );
373+
check( "?a=1&b=2=3&c=4", { { "a", "1" }, { "b", "2=3" }, { "c", "4" } } );
367374
}
368375

369376
void

0 commit comments

Comments
 (0)