Evaluation of $\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx$ 
Compute the indefinite integral
  $$
\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx
$$

My Attempt:
$$
\begin{align}
\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx &= \int\frac{\cos 2x}{\sin^2 x\sqrt{\cos 2x}}\sin xdx\\
&= \int\frac{2\cos^2 x-1}{(1-\cos^2 x)\sqrt{2\cos^2 x-1} }\sin x \,dx
\end{align}
$$
Let $\cos x = t$, so that $\sin x\,dx = -dt$. This changes the integral to
$$
\begin{align}
\int\frac{(2t^2-1)}{(t^2-1)\sqrt{2t^2-1}}\,dt &= \int\frac{(2t^2-2)+1}{(t^2-1)\sqrt{2t^2-1}}\,dt\\
&= 2\int\frac{dt}{\sqrt{2t^2-1}}+\int \frac{dt}{(t^2-1)\sqrt{2t^2-1}}
\end{align}
$$
How can I solve the integral from here?

Put $$\cos 2x =\frac{1 -\tan^2x}{1+\tan^2x}$$
$$\int\frac{\sqrt{1-\tan^2 x}}{\tan x}$$
$$1-\tan^2 x =t^2$$
$$\implies -2\tan x \sec^2 x dx=2tdt$$
$$\int\frac{t}{\tan x}.\frac{-tdt}{\tan x\sec^2 x}=-\int\frac{t^2}{(1-t^2)(2-t^2)}$$
$$=-\int\left[\frac{1}{(1-t^2)} -\frac{2}{(2-t^2)}\right]dt$$
$$=-\frac{1}{2}\log\left|{\frac{1+t}{1-t}}\right| +\frac{1}{\sqrt2}\log\left|{\frac{\sqrt2+t}{\sqrt2-t}}\right|$$
