mIRC Home    About    Download    Register    News    Help

Print Thread
#83325 17/05/04 07:38 PM
Joined: May 2004
Posts: 10
P
Pingh Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 10
Sorry if this is a repost, I've looked and haven't seen it in the forum.

I have an issue, and I am unsure how to proceed.
I want to connect to a site that is a subdomain of another domain.
for example site1.domain1.com

However everytime I open a socket to that domain alias, or subdomain it brings me back to the main domain site (ie domain1.com)
I assume it's trying to dns the site1.domain1.com and finds it to be the same address as domain1.com, and proceeds from there.
Is there anyway around this, or how do I connect to a subdomain?

Thanks in advanced.


#83326 17/05/04 07:44 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Using HTTP? Send the host header:

Host: sub.domain.com

That should do it.

#83327 17/05/04 07:54 PM
Joined: May 2004
Posts: 10
P
Pingh Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 10
That is how I am doing it
Code:
sockwrite -n pinghsock GET
sockwrite -n pinghsock Host: sub.domain.com $+ $crlf $+ $crlf 


However this still brings me back to just domain.com

#83328 17/05/04 08:15 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
To answer this kind of questions, it would help to know the address of the website in question.

#83329 17/05/04 08:22 PM
Joined: May 2004
Posts: 10
P
Pingh Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 10
I figured as much, was kinda avoiding it because I was trying to come off as creating a meaningful script, but oh well =>

jotun.ultrazone.org is the subdomain I am trying to connect to
and ultrazone.org is the one that I always end up at.

Again I assume it's because it's trying to look it up via dns, and gets the same ip for both.

#83330 17/05/04 08:46 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
One server may host multiple websites, and it's the Host header that makes the distinction between the domains you're trying to access. See this page for a friendly explanation.

#83331 17/05/04 08:48 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
It worked for me:
Code:
/sockopen echo2 jotun.ultrazone.org 80
/sockwrite -n echo2 GET / HTTP/1.1
/sockwrite -n echo2 Host: jotun.ultrazone.org
/sockwrite -n echo2


The server then sent me "Jon Honeycutt"'s page.

#83332 17/05/04 09:05 PM
Joined: May 2004
Posts: 10
P
Pingh Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 10
Thanks for the help.
I'm rather new at this so bare with me a little longer

The code above brought me to his page successfully (I wasn't using the http/1.* headers.

How would I then navigate to a page on his site in a subdirectory.

Normally I would do something like the following
Code:
sockwrite -n echo2 GET /g7/idlerpg/players.php


How would you do this with the HTTP headers?

I've read the article and was under the impression it was as follows:
Code:
GET /path/to/file/index.html HTTP/1.0


Which in my case would be
Code:
sockwrite -n echo2 GET /g7/idlerpg/players.php HTTP/1.0


which brings up a 404.
http://jotun.ultrazone.org/g7/players.php

Thanks for your continued assistance.

#83333 17/05/04 10:21 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It looks like the page you're looking for is /g7/players.php (and not /g7/[color:red]idlerpg/players.php[/color])

#83334 17/05/04 10:30 PM
Joined: May 2004
Posts: 10
P
Pingh Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 10
/me bashes head on keyboard.

Man, that one was killing me for hours..

Thanks for keeping with me.


Link Copied to Clipboard