Buildfile: determine a filename from a URL if the destination is a directory

This change allows for specifying a destination directory:

```
ADD http://example.com/foobar /usr/lib/
```

(This would download the file to `/usr/lib/foobar`.)

I've also introduced tests for downloading files from HTTP endpoints using `ADD`.