resolves #612 generate data uri for remote image

- generate data uri for remote image when data-uri & allow-uri-read are set
- add content-type logic to test webserver
- minor optimizations