Solved

Internet Host Name

Posted on 2000-04-19
9
226 Views
Last Modified: 2010-04-02
i'm writing a prog in which i assume
that a name of all the internet servers
is build like that:
http://name1.name2.name3
example:
http://www.google.com
so i would like to know it right

if not then if i have a request from the broweser how can i get the host name from it

example:
GET http://www.google.com/home_pg.gif HTTP 1.0

the host name is www.google.com

thanks
0
Comment
Question by:ntdragon
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 8

Expert Comment

by:Christoffer Swanström
ID: 2730606
In general, you can not assume that all server names consist of only three parts. Although most of them do, there also a lot of servers with 2,4,5... parts in their name.

I didn't really understand your question, could you define it a bit better?
0
 
LVL 5

Expert Comment

by:proskig
ID: 2730641
I agree with tosse, e.g. some have .co.uk instead of .com
0
 
LVL 86

Expert Comment

by:jkr
ID: 2730806
But you can assume that the host name is enclosed between '//' and the next '/'...
0
 
LVL 1

Author Comment

by:ntdragon
ID: 2732309
i would like to know
how can i get the host name from the broweser request

when broweser requests a file the request look like:

GET http://www.goole.com/home_page.gif HTTP 1.0 header...

i need to get the host name from these request <or any other request like it>

can i do what jkr said
i mean is the host name is writen between // and / <every host name>

my goal is to write a func that will get the host name from the request
<it shouldn't depend on the host name niether on the request what i mean is it should work for every request the broweser might send>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 86

Accepted Solution

by:
jkr earned 40 total points
ID: 2732346
>>can i do what jkr said
>>i mean is the host name is writen
>>between // and /

There is one exceptions, i.e. http servers that require user authentication - in this case, it'd be sth. like

http://user@server.subnet.subdomain.ext/

So the approach would be:

- isolate the string between '//' and the 1st '/' (or the end of the URL, if no path is given)
- look if there's an '@' - if so, the server name starts there...
0
 
LVL 1

Author Comment

by:ntdragon
ID: 2732381
i"ll write my funcand try it then i"ll get back
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2732456
There will undoubtedly be a RFC for this, index of those at http://www.internic.net/ds/rfc-index.htm
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2732488
0
 
LVL 1

Author Comment

by:ntdragon
ID: 2740660
thanks you all
my func work great with your help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now