Update transfer encoding code to current cowlib interface