adding better selection of separator in header

Hi,

I had a problem in production when user sent header containing commas, even if the separator is a semicolon.

This pull request select the first separator found in the header, respecting the position. The left most separator is chosen.