2009/5/28 Daniel Stenberg <daniel_at_haxx.se>:
> On Thu, 28 May 2009, Alexander Lamaison wrote:
>
>> filename parameters: The knownhost_*file functions take a const char*
>> filename parameter which they proceed to open and use. While this is common
>> in APIs, I would argue that it is better to take a FILE* and allow the
>> client code to open the file however it sees fit. The FILE interface was
>> purposely designed to allow any 'file-like object' to be used as a regular
>> disk file. An example of this is the glibc fmemopen function that creates a
>> memory-backed file.
>
> Hm right. I've faced troubles with that in the past. In windows for example,
> you can's pass such a file handle from an application to a DLL so it'd be
> impossible to use there!
Oh dear. That's a shame :( I had a look at this article
http://msdn.microsoft.com/en-us/library/ms235460.aspx and it says the
problem only occurs when libssh2 or its client is linked to the CRT
statically (/MT). Although I imagine this is uncommon, I don't think
it would be good to forbid this (unless, of course, we already do?).
> Posssibly we should consider the API to instead make full lines and let the
> app save those whereever it seems fit. Most people will not be able to get
> FILE * pointers to store in memory anywaay. We'd need somsthing similar done
> for the read function too then.
I hadn't realised that knownhost_get wasn't returning lines and I
agree that a line-based API is necessary. I think this can be
combined with Peter's suggestion. _read/_write work with lines and
_readfile/_writefile open and close files based on a filename and call
_read/_write inside a loop. If anyone needs a data-store that isn't a
real file, it would be very little work to make their own _read/_write
loop.
> I think I would instead suggest that if you really want to maintain the
> known_host file as much as possible you shouldn't use the savefile option but
> instead rather append new keys to the existing file.
I don't ;) But I thought it worth mentioning in case anyone does.
The one case is important, the encoding of each entry, seems to be
saved by hostline and honoured by dumpfile. Do I understand this
correctly?
Alex
-- http://swish.sourceforge.net ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ libssh2-devel mailing list libssh2-devel_at_lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-develReceived on 2009-05-28