FileRequest: make sure we're dealing with a file.

Trying to Read from a directory results in an error code, but we also
missed that because an unsigned variable was used to store the result.

Fixes #10210.
Added family parameter to the GetRoutes() API.
Moved common code to a private file.