The port argument to generate_url() is now cast to an int unless nil.