The Messenger of Allah ﷺ set out for Mecca and was fasting until he reached Usfan, where he called for a cup and drank from it. Shuba said this was during Ramadan. Ibn Abbas used to say, "Whoever wishes may fast, and whoever wishes may break his fast."
أخبرنا إسمعيل بن مسعود قال حدثنا خالد عن شعبة عن منصور عن مجاهد
خرج رسول الله ﷺ إلى مكة فصام حتى أتى عسفان فدعا بقدح فشرب قال شعبة في رمضان فكان ابن عباس يقول من شاء صام ومن شاء أفطر
[Sahih] Ibn Majah recorded it in Fasting, chapter on what has been said about fasting while traveling, hadith no. 1661, from the hadith of Mansur, with the same chain, and it is also found in Al-Kubra, hadith no. 2598. See the following hadith, which is the preserved version.