When any boundary layer on a straight wall is subjected to an expansive steady disturbance (either an incident wave, or departure of the wall shape from straight), or when a turbulent layer is subjected to a fairly weak compressive one, an interaction between the main stream (if supersonic) and the boundary layer is set up but the layer does not separate. Such an interaction is here treated mathematically by an extension of the author's method (Lighthill 1950) of perturbing a parallel flow and neglecting the disturbances of the viscous forces. It is shown that these are non-negligible only in an 'inner viscous sublayer', in which the Mach number remains small, and which for the turbulent layer is inside the so-called laminar sublayer. Further, if the disturbances are Fourier-analyzed longitudinally, then the effect of the inner viscous sublayer on the behaviour of each harmonic component outside it is exactly as if there were a solid wall at a certain position in the stream, with no flow across it and inviscid flow outside it. This position depends on the wave number k and on the skin friction in the undisturbed layer. This new boundary condition is now inserted into the old theory. Solutions are obtained for large and small k and used to deduce, respectively, (i) the principal local features of both the wall-pressure distribution and the flow outside the boundary layer, and (ii) the extent of upstream influence. An interpolation between them is used in an attempt to predict the complete form of the reflected wave when a shock is incident upon a turbulent layer. Reasonable agreement with experiment is obtained. The paper ends with a discussion of the skin friction distribution and how it influences the onset of non-linearity.