(bind-func ghttp_perform_request_with_setup_fn
(lambda (uri:i8* setup_fn:[void,ghttp_request*]*)
(let ((request:ghttp_request* (ghttp_request_new)))
(ghttp_set_extempore_user_agent request)
(if (= (ghttp_set_uri request uri) -1)
(begin (println "Error: invalid URI")
(ghttp_request_destroy request)
null)
(begin
(setup_fn request)
(ghttp_prepare request)
(if (= (ghttp_process request) ghttp_error)
(begin ;; (println "ghttp Error:" (ghttp_get_error request))
(ghttp_request_destroy request)
null)
request))))))