My horse almost killed a pit bull that attacked him once... None of my boys would put up with it, and if the owner got to see their nasty little animal trampled, even better (the pit bull's owners were a bit disappointed that the dog didn't die, apparently it was horrifically aggressive towards horses and nothing they could do other than put it down would stop it from trying to rip into any horse it saw.)
When I see the dogs coming I usually use a loud, stern voice and yell "GO HOME" or some such- in case the dog is actually semi-trained. It can either make the dog go away or at least not come too near and just bark. If they keep coming, I can usually count on my horse to take care of it. If the owner is close I'd suggest letting them know what a horse will do if attacked, and what you will do if your horse is hurt. If they either do nothing or aren't around/are too far away, the dog(s) is/are very aggressive and don't listen, and your horse isn't the fighting type, take off. Save your horse.
When I ride around my house, the dogs are usually just protecting their property so as long as I don't get too close they just bark, or they back off when I tell them to. Its the dogs in the washes and state parks that seem to be an issue... I actually much, much prefer the outside 'protector' dogs, because they do just that- protect, so if you keep distance, they're good.
Edit: I agree with Darrin- chase them down if they're too aggressive. The squirt gun idea sounds good too.