Initial work on porting write_url() and tests.