Wavefront control in high harmonics generation with few- and many-optical-cycle laser pulses