AW: [En-Nut-Discussion] BUG in NutTcpConnect???
Oliver Schulz
olischulz at web.de
Sat Sep 17 12:32:05 CEST 2005
Hi George and all other people!
First of all, there is NO bug in NutTCPConnect (at least no one as described
by George :-)!
To answer George's questions:
1. To open a TCP connection to a specific host, you just need the IP address
and the port number. Nothing more. For that reason, first the domain name is
converted to an ip address using DNS services.
Of course one physical host (with one ip address) can manage more than one
web site, but this differentiation is made on HTTP protocol level and not on
TCP connection establishing.
The example program IS using INETURL, in line #184 and #231. If you change
the define (line #82) from "/" to "/index.htm", the programm will request
the file "/index.htm" from the server as exspected. But of course, thats
still no solution to the many-web-sites-on-one-host-problem..
2. As you already figured out, in HTTP protocol there is a parameter named
"Host", which isn't used by this example program. But exactly this parameter
is used to distinguish between the many web sites on one server.
Now here comes the (simple) solution. Just add the following line after line
#184:
fprintf(stream, "Host: %s\r\n", INETSERVER);
And modify line #231 like this:
strcpy(buff, "GET " INETURL " HTTP/1.0\r\nHost: " INETSERVER
"\r\nUser-Agent: Ethernut [en] (NutOS)\r\n\r\n");
I hope that answers your questions.
@Harald: Please close the according bug in sf.net...
Regards,
Oliver.
-----Ursprüngliche Nachricht-----
This is a question primarily to the developers of the TCP-Functions!
For some weeks, I tried to get inetq-example to work, but with only a
minimal
success.
I also asked in the mailinglist, but without an answer.
(http://www.egnite.de/pipermail/en-nut-discussion/2005-September/004975.html
)
I now started to analyze the inetq-example, and get some mysterious things:
1. The inetq-example converts the domain to the ip-adress.
Then it calls NutTcpConnect with the ip and the port.
BUT it NEVER uses INETURL, why???
How to request a URL other than "/"?
2. This example works only, if the domain is on a dedicated server
(this means one ip per domain).
But what happens, when the server (with one IP) hosts more than
one domain on this single IP? (normaly till over 1000 domains).
=> My answer: the server has a problem, because he doesnt know
for which domain ethernut ask.
I then sniffed my browser to understand how it works.
Here the answer: after sending the "GET / HTTP/1.1"
it also sends the domain: "Host: www.ruinelli.ch".
BUT ethernet doesnt this!!!
Is this a BUG or did I forgot something?
This is also the reason, why only www.kornet.net but not
www.ethernut.de works.
(the IP of www.ethernut.de is: 217.160.92.226
now, try to load it on the browser, you will get:
"The domain "217.160.92.226" is not available.")
I really hope to get help from you!
George
More information about the En-Nut-Discussion
mailing list