Canadian visa rules for flight connections
I know that in the US foreigners must have a US visa if they have a connection in the US, even if they fly from a different country to a different country. That is because in the US you have to go through passport control regardless of your final destination.
What is the situation in Canada? Does a person who would need a visa to enter Canada need a visa to connect through Canada without exiting the airport?
The answer depends entirely on the nationality of the traveler, which country they are traveling to, and which specific airport they are traveling through in Canada - but in general most flights through Canada airports do require you to pass through Canadian Immigration, and thus if you require a Visa to enter Canada, you will need one to transit too.
Star Alliance has a good tool on their website at that will tell you whether you need a Visa for a specific trip - both at your destination country as well as at a transit country.
There are a few exceptions the the requirements listed on that site if you are traveling to the US via Canada, such as the "China Transit Trial" (travel from China to the US via Canada, on a small set of airlines and through a small number of airports), but these are the exception and not the rule.
By any chance, do you know if having a U.S. Green Card (permanent residency) for a connection in Canada (Toronto) involving U.S. (as the origin or denstination) changes anything? (I looks that it doesn't make any difference as Green Card is not mentioned in the Canada's embasy website). But maybe in practice it still makes a difference(?)
@alfC: US permanent residents do not need a visa to visit (or transit) Canada. Starting in March 2016 they will need eTA, like all visa-exempt people other than US nationals.