Section 39. The officer serving the precept in a criminal case shall, without charging travel therefor, return it with his doings and fees endorsed thereon to the court or magistrate issuing it, who shall tax, allow and certify the fees as a part of the expenses in the case. In case of commitment, the officer shall leave with the superintendent, jailer or keeper of the prison an attested copy of the precept, with his return thereon, which shall authorize the detention of the person committed.