backport If-Modified-Since fix from tornado

See facebook/tornado#713

closes #3177