Correctly replace headers in middleware

`PATH_INFO` and `REQUEST_URI` don't always match each other, and they don't always match `@request.path`. This is especially true if the app is mounted in a subdirectory in Apache. In that case (assuming the app is mounted at `/foo/bar` and the request is for `/foo/bar/baz.pdf?quux=1`:

*  `REQUEST_URI` will be something like `/foo/bar/baz.pdf?quux=1`
* `PATH_INFO` will be something like `/baz.pdf`
* `@request.path` will be something like `/foo/bar/baz.pdf`

This pull request changes the middleware to replace the `.pdf` extension in headers with themselves instead of with `@request.path`. I didn't see any tests for the middleware, so I haven't added any.
Merge pull request #324 from jredville/patch-1

Correctly replace headers in middleware