mIRC Homepage
Posted By: Pingh Subdomains and sockets. - 17/05/04 07:38 PM
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.

Posted By: Collective Re: Subdomains and sockets. - 17/05/04 07:44 PM
Using HTTP? Send the host header:

Host: sub.domain.com

That should do it.
Posted By: Pingh Re: Subdomains and sockets. - 17/05/04 07:54 PM
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
Posted By: Online Re: Subdomains and sockets. - 17/05/04 08:15 PM
To answer this kind of questions, it would help to know the address of the website in question.
Posted By: Pingh Re: Subdomains and sockets. - 17/05/04 08:22 PM
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.
Posted By: Online Re: Subdomains and sockets. - 17/05/04 08:46 PM
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.
Posted By: Collective Re: Subdomains and sockets. - 17/05/04 08:48 PM
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.
Posted By: Pingh Re: Subdomains and sockets. - 17/05/04 09:05 PM
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.
Posted By: Online Re: Subdomains and sockets. - 17/05/04 10:21 PM
It looks like the page you're looking for is /g7/players.php (and not /g7/[color:red]idlerpg/players.php[/color])
Posted By: Pingh Re: Subdomains and sockets. - 17/05/04 10:30 PM
/me bashes head on keyboard.

Man, that one was killing me for hours..

Thanks for keeping with me.
© mIRC Discussion Forums