What is the cause the light is affected by gravity? I know that photons have no mass and that a photons exist only moving at the speed of light. So what is the cause that a massive astronomical object can bend a ray of light?
I have two thoughts, but I am confused which of these, if any is correct:


*

*A gravitational field of a massive astronomical object curves spacetime and affects the light traveling near this object indirectly.  That is, for external viewers the light bends, but for the light itself it is still traveling in a straight line. So I mean, that the coordinates in that place are curved, but only for the external viewer.

*Energy of a photon is equivalent to mass, so the gravity field interacts with photons directly the same way, as if they would have mass (equivalent to the energy).
 A: I believe that both of your thoughts are basically correct!


*

*Momentum and energy, including mass, affect the curvature of space. Light rays travel along the quickest routes in this curved space (which are called null geodesics, and are the generalization of the straight lines you mention, but for curved space). 

*The light ray, though, also itself contributes to the momentum and energy that is curving the space. Light has no mass, but it is energy and momentum that curves space, and light has these things.


Wheeler (see wiki) puts it nicely, 

Spacetime tells matter how to move; matter tells spacetime how to curve.

Though for your question, we need to generalize this to,

Spacetime tells matter and light how to move; matter and light tells spacetime how to curve.

However, the phenomena of massive objects bending light rays that you described (gravitational lensing) is related only the first statement - that matter tells spacetime how to curve and that light rays follow these curves. The effect of the light's energy is negligible.
A: You're first guess is essentially it. The light itself isn't affected by gravity. The space through which the light is traveling is what's actually being manipulated by gravity. Note that in physics, a "straight line" between two points is operationally defined as the path taken by light, though the term 'geodesic' is preserved over straight. Light does follow the straightest possible path, though.
A: Gravity interacts with photons directly, but this has nothing to do with mass equivalence.
For massive particles, the equivalence of (passive) gravitational and inertial masses means that the mass of a test particle is not relevant to its freefall trajectory. It's determined by the initial position and velocity, not mass. Therefore, if even massive test particles don't care about what mass they are, thinking in terms of mass-energy equivalence is a red herring for this particular purpose.
Test particles follow geodesics (straight paths) of the spacetime geometry, but spacetime geometry is gravity. That's about as "direct" as it gets. This is true regardless of whether they're massive or massless. The only difference is that massless particles are required to have null (lightlike) initial velocities.
