Here is a function I wrote to merge a "base" url with a "partial" url (from
something like <a href='/whatever.asp?parm1=7 . . .>"
-------
function UrlMerge (baseurl:AnsiString; targeturl:AnsiString): AnsiString;
var
holdurl:AnsiString='';
Begin
holdurl:=targeturl;
parseurlresult:=ParseURL(baseurl, Prot, User, Pass, Host, Port, Path, Para);
parseurlresult:=ParseURL(targeturl, xProt, xUser, xPass, xHost, xPort, xPath,
xPara);
If (Midstr(UpCase(targeturl),1,5)<>'HTTP:')
and (Midstr(UpCase(targeturl),1,11)<>'JAVASCRIPT:') Then Begin
If (MidStr(targeturl,1,1)='/') Then
holdurl:=Prot+'://'+Host+targeturl
Else Begin
j:=Rpos('/',baseurl);
If (j=0) Then
holdurl:=baseurl+'/'+targeturl
Else
holdurl:=MidStr(baseurl,1,j)+targeturl;
End;
End;
UrlMerge:=holdurl;
End;
---------------------------------
I know it's not pretty, but it seems to work.
I don't think there is anything like this in synapse already.
(hint: might be nice to include something like this in the next release)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public