Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-04-11 17:23:41

Alexander Nasonov wrote:
> Peter Dimov wrote:
>> std::ifstream is( "" );
>> std::ofstream os( "" );
>> os << is.rdbuf();
>> No proposal required, in principle.
> Are you aware of (a) ambiguity and (b) potential security hole?

Yes, I am aware of both. It's a tradeoff.

> (a)
>> mkdir http:
>> mkdir http:/
>> touch http:/
>> file
> empty
> (b)
> If you replace the first line with something more generic, for example
> with:
> std::ifstream is( argv[1] );
> it becomes unclear that the code might send requests to the net.

The code can already send requests to the net; an example is


under Windows. In most cases, allowing existing code to seamlessly read from
remote files over HTTP or FTP is a feature. PHP, for example, does that in
its fopen, and most graphical shells also maintain this illusion.

Anyway, I just wanted to illustrate the fact that standard library
implementors already have the ability to add HTTP/FTP functionality;
unfortunately, none have done so. C++ is a somewhat conservative language.

The obvious alternative is, of course,

    std::tr2::iurlstream is( "" );

which does require a proposal, albeit a relatively simple one. ASIO need not
be involved in any way, and the implementation under Windows can use
WinInet, for example.

Boost list run by bdawes at, gregod at, cpdaniel at, john at