An HTTP application request for www.stackoverflow.com. This message is passed to Transport layer. Transport layer adds its header and sends the packet to Internet Layer. The Internet Layer cannot see www.stackoverflow.com as it can only access the header which was appended by Transport Layer. Then how can Internet Layer decide route for this request packet.
How is the destination address field in IP header is filled, as only Application Layar and Transport Layer know about that field. (Application layer has no interaction with Internet Layer and Transport Layer mention port number in its Header.)