The below code works as long as I comment out the s.Free line in the function, but I have 3 unfreed memory blocks.
When it works, I receive the desired simple string from my web server.
When I enable the s.Free line, I get a SIGSEGV.
And I think I should create and free the variable VerFromServer in the calling procedure, but when I add the the create / free, I also get a SIGSEGV.
Any thoughts / suggestions / RTFM links? (ah, that would be "Read the FINE manual!" grin)
note: I'm not attempting to do a httpS transaction.
Function GetHTTPfile(const url: string) : tstringlist;
// gets a file from the named url and returns the file contents
// I'm using this to get the current version of the application from the web server
var
s : tstringlist;
gotResponse : Boolean;
begin
s := tstringlist.create;
gotResponse := HttpGetText(url,s);
// showmessage(s.text);
if gotResponse = true
then GetHTTPFile := s;
// s.Free;
end; // of GetHTTPfile
Procedure CheckforPgmUpdate();
var
VerFromServer : tStringList;
VerServer : String;
begin
VerFromServer := GetHTTPfile(VerFile); // VerFile is a string containing the desired URL...
VerServer := VerFromServer[0];
If VerFromServer[0] > ver1 // ie: a newer version is available ...
then ShowMessage('A newer version of the progarm is available.'
+ SLineBreak + 'Visit the web site to download it.');
end; // for CheckforPgmUpdate