Here are a couple of thoughts:
High HC is possible for both too rich and too lean of a/f mixture. Too rich of a/f will result in high HC and high CO. Too lean of a/f will result in high HC but not high CO.
So, if you are only failing due to high HC, I would conclude that you have a lean mixture at idle. This conclusion would be supported by your report that it idles at 900 rpm, which is too high, and suggests a vacuum leak - that would increase idle speed and result in lean at idle. So, I would look for and fix any vacuum leaks you can find. I would also clean the mafs, since a dirty mafs will read less airflow than what there actually is.
You could also have a misfire due to poor plug or plug wires, or oil in plug holes, but I would expect high CO to go along with the high HC.
Your exhaust leak may be causing you problems with the emission test, especially if that leak is close to the engine. This is because the exhaust flow is not like water flowing through a garden hose, but rather a series of sharp pulses of positive and negative pressure (from the exhaust valves opening and closing). That means fresh air is sucked into the exhaust system at that leak, and the oxygen in that air can confuse the O2 sensor if the leak is before the sensor, and can possibly react with unburned HC in undesirable ways. The point is that you cannot just ignore the exhaust leak - it may be contributing to your problems.