Whenever any writ of habeas corpus shall be served upon the sheriff or any other person to whom the same may be directed, or who may be ordered summoned thereby, he shall bring, or permit the officer executing the writ to bring, the body of the prisoner or person detained in custody before the judge who is to try the same, at the time and place designated in the writ, or, in case of the absence of such judge, then before any other judge, and to make return or answer to said writ.