CBQE-0: fixes in build_url()

Change-Id: I73fb167366b8050094d1e29d9876fc5770c0d406
Reviewed-on: http://review.couchbase.org/30314
Reviewed-by: Andrei Baranouski <andrei.baranouski@gmail.com>
Tested-by: Andrei Baranouski <andrei.baranouski@gmail.com>