MB-12251: Use the common function to parse the query parameters

Instead of extracting the stale and debug parameter manually, use the
existing parse function to get the parameters. This makes things less
fragile and error prone.

Change-Id: I4949447dd37305531bc41bde78d0e0424e5b4d00
Reviewed-on: http://review.couchbase.org/42761
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Sarath Lakshman <sarath@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>