For the standard idiot dog who runs out of his/her yard, I haul my dog in and glare at it, puffed up like a peacock, and shout in a deep voice to STOP and GO HOME. This usually shocks the dog into skidding to a stop, and if I'm lucky, it'll get the owner's attention and motivate him to come retrieve Rover. If the dog rushes up barking, running around, being a pest but not being nasty, I'll keep my dog to my side and try to walk out of 'his territory' and leave him behind. Sometimes I'll yell for the owner to come get his/her dog.
For a dog who slows or stops but clearly still has hopes of jumping us, I start bellowing for the owner, and give the dog a very, very clear "F#ck Off" stance. At this stage, I don't think it's a matter of me antagonizing the dog anymore; the dog's already wavering, thinking about attacking, and I want to make it clear that he'll have trouble from me if he does. I turn around walk away with my dog, keeping an eye on the loose dog, and usually the combination of antagonism and retreat helps them decide to not pursue the issue.
I carry Halt!, which I doubt would dissuade a true aggressive dog, and a penknife. And I have grabbed sticks off the ground before. I won't hurt a dog who's just a pest, but sometimes they do cross the line and start pushing their luck because they're getting no proper guidance from their owner. In maybe 20 years of walking my dogs, I've gone through three vicious attacks, attacks where the other dog was clearly attempting to kill my dog. In each case, stopping the attack required a strong person physically dragging the attacking dog off my dog. I have no faith that Halt! or even pepper spray would stop an attack like this; it may be paranoia, but I'm very cautious on a walk, very alert to sounds (like tags jingling or a door opening) that may accompany a dog in the area.