🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: microsoft.public.inetsdk.programming.wininet
4 messages
4 total messages Started by justin chan Wed, 26 Sep 2001 00:29
WinInet - InternetCombineURL alternative
#11
Author: justin chan
Date: Wed, 26 Sep 2001 00:29
17 lines
1505 bytes
Hi,

Currently I'm using 'InternetCombineURL' function from WinInet to
combine a base and relative URL into a single URL.
eg. Base: http://www.myserver.com/folder/
    Relative: ../file.html
    Result: http://www.myserver.com/file.html

However, because I want to make my application portable, I'm removing
dependencies on WinInet.

Does anyone know if there is an alternative to 'InternetCombineURL'
and does not rely on WinInet??

Thanks..

Justin
Re: WinInet - InternetCombineURL alternative
#10
Author: Adam
Date: Wed, 26 Sep 2001 23:44
25 lines
2032 bytes
When you say "portable" most systems have wininet.dll installed. It is part
of the OS in Win '98 and >. But for users with Win '95 - all they need is IE
4 or >.

Adam.

"justin chan" <jayc@start.com.au> wrote in message
news:16379a2c.0109251629.5566caa3@posting.google.com...
> Hi,
>
> Currently I'm using 'InternetCombineURL' function from WinInet to
> combine a base and relative URL into a single URL.
> eg. Base: http://www.myserver.com/folder/
>     Relative: ../file.html
>     Result: http://www.myserver.com/file.html
>
> However, because I want to make my application portable, I'm removing
> dependencies on WinInet.
>
> Does anyone know if there is an alternative to 'InternetCombineURL'
> and does not rely on WinInet??
>
> Thanks..
>
> Justin
Re: WinInet - InternetCombineURL alternative
#8
Author: Richard Heathfield
Date: Thu, 27 Sep 2001 06:00
72 lines
3913 bytes
Adam wrote:
> 
> When you say "portable" most systems have wininet.dll installed.

I just checked my Linux installation and hey, what do you know, it's not
there. In comp.programming (which is where I'm reading this), "portable"
means more than just "portable to Windows".

> It is part
> of the OS in Win '98 and >. But for users with Win '95 - all they need is IE
> 4 or >.

<shrug>

> "justin chan" <jayc@start.com.au> wrote in message
> news:16379a2c.0109251629.5566caa3@posting.google.com...
> > Hi,
> >
> > Currently I'm using 'InternetCombineURL' function from WinInet to
> > combine a base and relative URL into a single URL.
> > eg. Base: http://www.myserver.com/folder/
> >     Relative: ../file.html
> >     Result: http://www.myserver.com/file.html
> >
> > However, because I want to make my application portable, I'm removing
> > dependencies on WinInet.

Excellent.

> >
> > Does anyone know if there is an alternative to 'InternetCombineURL'
> > and does not rely on WinInet??

Yes, Justin, it's called "programming".  :-)

Start off with your base URL. Parse on the / character. This gives you
tokens http: (in your example), www.myserver.com, and folder.

Build a data structure that represents that relationship:

      www.myserver.com
            ^
            |
            |
            |
            V
          folder

This rather simple example doesn't explain things very well, but
basically you'd have each node pointing to an array of child nodes and
also to a parent node (with the server node itself having a parent of
NULL). That would enable you to build up a picture of the server as you
go.

Anyway, from that start, finding a relative path is trivial. Start at
the "current" directory - in your case, www.myserver.com/folder - and
parse, again on the / character. If you hit a . on its own, you can
discard it. If you hit on .. on their own, you need to go one place
nearer the root. If you hit a token terminated by a /, you need to
change into that directory (possibly creating a new node in your data
structure in order to represent it), and if you hit a non-empty token
not ending in / at the end, that's the file you're after.

It's really relatively simple, but also relatively interesting, and well
worth the exercise of programming for yourself.


-- 
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Re: WinInet - InternetCombineURL alternative
#9
Author: justin chan
Date: Thu, 27 Sep 2001 06:32
36 lines
2415 bytes
I mean "portable" as in.. I want to make a Linux port of my
application.
Therefore, WinInet has to go... but I still haven't worked out how I
am going to replace 'InternetCombineURL' function from WinInet.
Surely this has been done so many times before so I'd rather use
someone elses implementation otherwise I'll have to write something up
myself.

justin

"Adam" <adaml@ihug.com.au> wrote in message news:<9otpac$2e9$1@bugstomper.ihug.com.au>...
> When you say "portable" most systems have wininet.dll installed. It is part
> of the OS in Win '98 and >. But for users with Win '95 - all they need is IE
> 4 or >.
> 
> Adam.
> 
> "justin chan" <jayc@start.com.au> wrote in message
> news:16379a2c.0109251629.5566caa3@posting.google.com...
> > Hi,
> >
> > Currently I'm using 'InternetCombineURL' function from WinInet to
> > combine a base and relative URL into a single URL.
> > eg. Base: http://www.myserver.com/folder/
> >     Relative: ../file.html
> >     Result: http://www.myserver.com/file.html
> >
> > However, because I want to make my application portable, I'm removing
> > dependencies on WinInet.
> >
> > Does anyone know if there is an alternative to 'InternetCombineURL'
> > and does not rely on WinInet??
> >
> > Thanks..
> >
> > Justin
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads