Q. How concerned does one need to be about walking on Shabbos in a busy street, with an accumulation of saliva and phlegm in his mouth that he has to spit out. Can he continue walking in a reshus horabim until he finds a proper place to spit it out, that will not create a chilul Hashem?
A. Shulchan Aruch (O.H. 350: 3) rules that if spittle has accumulated in one’s mouth and one is ready to spit it out, one should not walk with it four amos in a public domain, or carry it on one’s mouth from ine domain to another. Mishna Berura (ibid. 12) quotes Eliahu Rabboh asserting that it applies only if the spittle has been swiveled and turned over already in one’s mouth, and it is ready to be expectorated.
Horav Shlomo Miller’s Shlit’a opinion is that if one is already on the move, he should continue until he reaches an appropriate makom petur where it can be properly discharged.
If one is at rest then he should try to walk less than four amos until he finds a place where he can discreetly spit it out.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit’a