[#2222] [#2212] CID25770, CID25745, and CID25688:
[#2222] [#2212] CID25770, CID25745, and CID25688:

use actual buffers and buffer lengths to check instead of cached
lengths, also more concise header population

PaulVanSchayck/irods,janiheikkinen/irods,janiheikkinen/irods,PaulVanSchayck/irods,janiheikkinen/irods,janiheikkinen/irods,PaulVanSchayck/irods,janiheikkinen/irods,janiheikkinen/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,janiheikkinen/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,PaulVanSchayck/irods,janiheikkinen/irods,PaulVanSchayck/irods,janiheikkinen/irods