(a) General rule.--The officer or persons executing the Governor's warrant of arrest or the agent of the demanding state to whom the prisoner may have been delivered may, when necessary, confine the prisoner in the jail of any county or city or borough through which he may pass, and the keeper of such jail must receive and safely keep the prisoner until the officer or person having charge of him is ready to proceed on his route, such officer or person being chargeable with the expense of keeping.
(b) Prisoner in transit.--The officer or agent of a demanding state to whom a prisoner may have been delivered following extradition proceedings in another state, or to whom a prisoner may have been delivered after waiving extradition in such other state, and who is passing through this Commonwealth with such a prisoner for the purpose of immediately returning such prisoner to the demanding state, may, when necessary, confine the prisoner in the jail of any county or city or borough through which he may pass, and the keeper of such jail must receive and safely keep the prisoner until the officer or agent having charge of him is ready to proceed on his route, such officer or agent, however, being chargeable with the expense of keeping. Such officer or agent shall produce and show to the keeper of such jail satisfactory written evidence of the fact that he is actually transporting such prisoner to the demanding state after a requisition by the executive authority of such demanding state. Such prisoner shall not be entitled to demand a new requisition while in this Commonwealth.