In A New Hope, Han introduces himself as the captain of the Millennium Falcon. In The Empire Strikes Back and Return of the Jedi, many also refer to him as "Captain Solo", including various Rebels (Luke, Zev Senesca), droids (C-3PO), Imperials (Darth Vader), and others (Boba Fett, Jabba). Is there a definitive source on whether this was his military rank in the Alliance, or just in reference to his being captain of the Millennium Falcon?
Searching for "captain" in the TESB and ROTJ scripts is inconclusive; the script refers to him as a "star captain" at one point in ROTJ, but no one refers to him as "Captain" after he becomes a General.
I know that he does at least have the title of Captain for his ownership of the Falcon, but I'm asking because I've seen trivia questions like "Q: what was Han Solo's rank in the Rebellion in TESB; A: Captain" (and other questions like this), so it would be nice to have a canon (or formerly canon) source to give an answer one way or the other. The starwars.com databank entry just says he was "promoted to general", and presumably he'd have to have some sort of rank beforehand for it to be a "promotion".