A method to measure the wavefront of short pulsed lasers through second-harmonic generation