We use the expression “to stand the gaff” usually in the sense of “to take punishment,” but often employ it for mental fortitude rather than physical, “to accept raillery in good spirit.”
A gaff, of course, is a pointed hook on the end of a long rod and is used for landing large fish, or at least that is the instrument most commonly known.
But there is also a Scottish and provincial English word, “gaff,” which means noisy, insulting language; so it is possible that the expression, “to stand the gaff,” may very literally mean “to take punishment, as from a steel hook,” or “to withstand raillery, as from insulting remarks.”