Fix datastore assignments
Fix file handle leak
Um, this is the right way to do it.
Extract query params separately

Prevents stomping on data
Land #3629, @wchen-r7's HTTP traversal fixes