Exact format for WebSocket request header?

You are really over complicated it here.

Just speak IRC if talking to the IRC ports
And speak websockets if talking to websockets.
Anything else you are just spinning wheels for no reason

The real question is why are you trying to over complicate things and mess about with headers for no reason?