Trignometric integral : $\int \frac{dx}{\sin x + \sec x}$ The integral I am trying to compute is : 
$$\int \dfrac{dx}{\sin x + \sec x}$$
I have tried manipulating trignometric functions and it took me nowhere. Then finally I tried putting $\tan\dfrac{x}{2} = t$, and subsequently:
$$=\int\dfrac{1-t^2}{(1+t^2)^2-2t(t^2-1)}dt$$
I cannot see how to approach after this, I know we have to factor out two quadratics, but cant see how to.
Also, if there was another method instead of this substitution, please hint on that too! Thanks!
 A: Another way:
$$\dfrac{2\cos x}{2+2\cos x\sin x}=\dfrac{\cos x-\sin x}{2+2\cos x\sin x}+\dfrac{\cos x+\sin x}{2+2\cos x\sin x}$$
As $\displaystyle\int(\cos x-\sin x)dx=\cos x+\sin x,$ write $2\cos x\sin x=(\cos x+\sin x)^2-1$ and set $\cos x+\sin x=u$
and as $\displaystyle\int(\cos x+\sin x)dx=\sin x-\cos x,$ write $2\cos x\sin x=1-(\sin x-\cos x)^2$ and set $\sin x-\cos x=v$
A: As Michael Wang commented $$A=(1+t^2)^2-2t(t^2-1)=t^4-2 t^3+2 t^2+2 t+1$$ Computing the roots of the quartic equation (all are complex), you end with
$$A=\left(t^2+(\sqrt{3}-1)t-\sqrt{3}+2\right)\left(t^2-(\sqrt{3}+1) t+\sqrt{3}+2\right)$$ Partial fraction decomposition then leads to 
$$\dfrac{1-t^2}{(1+t^2)^2-2t(t^2-1)}=\frac{1+t}{t^2+(\sqrt{3}-1)t-\sqrt{3}+2}+\frac{1+t}{t^2-(\sqrt{3}+1) t+\sqrt{3}+2}$$ which makes the problem workable.
Edit
Being less lazy, write $$(t^2+at+b)(t^2+ct+d)-(t^4-2 t^3+2 t^2+2 t+1)=0$$ Expand and group terms to get $$(a+c+2)t^3+ (a c+b+d-2)t^2+ (a d+b c-2)t+(b d-1)=0$$ So the equations to be solved are $$a+c+2=0\tag 1$$ $$a c+b+d-2=0\tag 2$$ $$a d+b c-2=0\tag 3$$ $$bd-1=0\tag 4$$ Using $(4)$, then $d=\frac 1b$. Using $(1)$, then $c=-2-a$. Replace in $(2)$ to get $$\frac{a}{b}-(a+2) b-2=0\implies a=\frac{2 b}{1-b}$$ Now, plug everything in $(3)$ to get $$\frac{(b^2-4b+1) \left(b^2+1\right)}{(b-1)^2 b}=0\implies b^2-4b+1=0$$
A: This is an adjunct to @Claude Leibovici's insight. From Mathematica:
$$
\int \frac{dx} {\sin x + \sec x} =
\tan ^{-1}\left(\left(\sqrt{3}+1\right) \tan \left(\frac{x}{2}\right)+1\right)+\tan ^{-1}\left(1-\left(\sqrt{3}-1\right) \tan \left(\frac{x}{2}\right)\right)+\frac{\log \left(2-\frac{2 \left(\sin (x)+\sqrt{3}+1\right)}{\cos (x)+1}\right)-\log \left(\sec ^2\left(\frac{x}{2}\right) \left(-\sin (x)+\cos (x)+\sqrt{3}\right)\right)}{2 \sqrt{3}}.
$$
