Allocate r->uri.len * 3 + __1__  as this needs to be a zero terminated string