url-package-name and url-package-version are only used in the initializer of the url-user-agent, which is computed when url.el is loaded; this makes these two variables essentially useless; in particular, one can't let-bind them around a call to url-retrieve. The fix is probably to make url-user-agent accept nil, and make the url-http-user-agent-string function generate the default string every time it is called, based on the current values of url-package-name and url-package-version. I have some code to do this, but I'd just like to make sure that it's the right approach before I propose a patch.