Couldn't this be simplified to:

if (head_response->content_length != 0) {
    sprintf(struct_str, "%" G_GUINT64_FORMAT, head_response->content_length);
}