I'm not sure I like moving this into a function.  Most of the heavy lifting is already encapsulated in translate_request_uri, so the only function in do_enum_lookup is the test to see whether it is appropriate to an ENUM lookup and the sending of the response on a failure.  I would argue both of those functions below at this level anyway

-   do_enum_lookup as a function name suggests it will definitely do an ENUM lookup, whereas in fact it may not happen
-   it would be more in keeping with other code to do the error response at this level, and it would avoid you having to test your enum_lookup_successful variable later.