  Despite great observational and theoretical effort, the burst progenitor is
still a mysterious object. It is generally accepted that one of the best ways
to unveil its nature is the study of the properties of the close environment in
which the explosion takes place. We discuss the potentiality and feasibility of
time resolved X-ray spectroscopy, focusing on the prompt gamma-ray phase. We
show that the study of absorption features (or continuum absorption) can reveal
the radial structure of the close environment, unaccessible with different
techniques. We discuss the detection of absorption in the prompt and afterglow
spectra of several bursts, showing how these are consistent with gamma-ray
bursts taking place in dense regions. In particular, we show that the radius
and density of the surrounding cloud can be measured through the evolution of
the column density in the prompt burst phase. The derived cloud properties are
similar to those of the star forming cocoons and globules within molecular
clouds. We conclude that the burst are likely associated with the final
evolutionary stages of massive stars.
