bugfix : ensure clearing the useragent buffer filled in by previous requests
minor cleanings + proper error response if the request is not valid