(bind-func ghttp_print_request_headers
(lambda (request:ghttp_request*)
(if (null? request)
(println "Error: request is null.")
(let ((hdrptr:i8*** (salloc))
(hdrcount:i32* (salloc))
(i 0))
(ghttp_get_header_names request hdrptr hdrcount)
(println "HTTP headers:\n")
(dotimes (i (convert (pref hdrcount 0) i64))
(printf "%s: %s\n"
(pref (pref hdrptr 0) i)
(ghttp_get_header request (pref (pref hdrptr 0) i)))
(free (pref (pref hdrptr 0) i)))))))