extracted from actual git-http-backend's source code, so you can use it directly without any worry
https://github.com/git/git/blob/39fe402d6727efb6c98ddca19fae1f094ffaa6b3/http-backend.c#L713-L726C2