rejetto forum

Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on April 30, 2009, 01:09:49 PM

Title: http:// only ?
Post by: Mars on April 30, 2009, 01:09:49 PM
Am I right to add:

Quote
  procedure load(fn:string; varname:string='');
  begin
  if ansiStartsText('http://', fn) or ansiStartsText('https://', p) then result:=httpGet(fn)
  else result:=loadFile(uri2diskMaybe(fn));

.......

if name = 'filesize' then
      begin
      if ansiStartsText('http://', p) or ansiStartsText('https://', p) then i:=httpFileSize(p)
      else i:=sizeOfFile(uri2diskMaybe(p));
      result:=intToStr(max(0,i));
      end;

Otherwise macros load and filesize cannot work through ssl with https://......
 ;)
Title: Re: http:// only ?
Post by: rejetto on April 30, 2009, 02:35:05 PM
it makes sense only if httpget and httpfilesize work over https.
do they?
Title: Re: http:// only ?
Post by: Mars on May 04, 2009, 10:27:12 PM
it makes sense only if httpget and httpfilesize work over https.
do they?

The probability of such an event is not invalid. It seems to me necessary to make this modification, because it is not excluded having to load a file or its size from a typical server with ssl support
Title: Re: http:// only ?
Post by: rejetto on May 05, 2009, 08:56:23 AM
i will reply to my question: No, they don't support https yet. :)

but ok, we'll put that code for the future, there are no bad side effects.
Title: Re: http:// only ?
Post by: Mars on May 12, 2009, 02:09:57 PM
Quote
   if name = 'load' then
      load(par(0), par(1,'var'));



  procedure load(fn:string; varname:string='');
  begin
  if reMatch(p, '^https?://', 'i!') > 0 then
    result:=httpGet(fn)
  else
    result:=loadFile(uri2diskMaybe(fn));

if anyCharIn('/\',fn) then result:=macroQuote(result);

?????????

Quote
   if name = 'load' then
      load(p, par(1,'var'));



  procedure load(fn:string; varname:string='');
  begin
  if reMatch(fn, '^https?://', 'i!') > 0 then
    result:=httpGet(fn)
  else
    result:=loadFile(uri2diskMaybe(fn));

if anyCharIn('/\',fn) then result:=macroQuote(result);

or

Quote
   if name = 'load' then
      load(par(1,'var'));



  procedure load(varname:string='');
  begin
  if reMatch(p, '^https?://', 'i!') > 0 then
    result:=httpGet(p)
  else
    result:=loadFile(uri2diskMaybe(p));

if anyCharIn('/\',p) then result:=macroQuote(result);

 ;)
Title: Re: http:// only ?
Post by: rejetto on May 12, 2009, 04:22:16 PM
right
fixed :)