factor out header logic from send_data_record