Add secure flag to requests

This is an updated version of https://github.com/playframework/playframework/pull/1326, incorporating
suggestions in the comments, and including tests.