Advertisement

HTTP GET Index Command :: Winsock

Started by December 16, 2002 11:18 PM
15 comments, last by kuphryn 22 years, 1 month ago
Okay. Thanks.

You may be right about the Host. Some server require the Host to be exact. For instance, www.xyz.com might want members.xyz.com. There is no way to determine what the server wants without first seeing an error response.

Kuphryn
quote:
Original post by kuphryn
Okay. Thanks.

You may be right about the Host. Some server require the Host to be exact. For instance, www.xyz.com might want members.xyz.com. There is no way to determine what the server wants without first seeing an error response.

Kuphryn


You might try this site: http://www.jmarshall.com/easy/http/


Patrick
Advertisement
If you are on the Windows platform use the WinInet API instead of re-inventing the wheel. If your goal is to learn the HTTP protocol, then you''re gonig about it the wrong way... look at the RFC that defines the protocol, as someone else mentioned. If that isn''t your goal, then make it easier on yourself by using the existing API designed for this.
Listen, this is not a huge issue.

Simply wrap your GET request in a header like this..


  GET / HTTP/1.1Accept: */*Accept-Language: en-usUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)Host: IP TO CONNECT TOConnection: Keep-Alive  


This will work. Subfiles/directories can be accessed like "GET /hello/bye.html".

You could have easily figured this out simply by having Internet Explorer or Netscape try to connect to your IP, and logging the packet data with Winsock.

This is a standard request from nearly every browser. The only thing different is the User-Agent, which is based on the browser which is sending the request.


swift URL | browse my bookmarks [server may not always be on]

Sensimed | Info/download
quote:
Original post by vtwin
Host: IP TO CONNECT TO

The host header shall contain the FQDN host name of the (virtual) server, not the IP address:

telnet 216.185.96.230 80

GET /community/forums/topic.asp?topic_id=128843 HTTP/1.1
Host: www.gamedev.net




Okay. Thanks.

One last question. Under the "Accept" command section, does it force the server to not send links to all other data? For example:

Accept: text/html

Does the code above force the server to not send other data type such as pictures and media files? How about */*? Does the wildcard force the server to send the website (html file) and all file it shows including pictures and media files if applicable?

Kuphryn
Advertisement
An easy way to see what header information you need it to open up port 80 on your local machine and point a real browser to it.

The only thing you want to take out is the gzip stuff unless you have a gzip decompressor in your browser. It''s significantly faster to get compressed pages but you need the extra step to decode it.

Some hosts don''t care what host you specify in the header. Sites like Pcgamer will redirect you to some random site if you don''t have it set properly. Gamedev will tell you it doesn''t exist.

Slashdot puts quotes in it''s headers when you pull a page down. Mostly Futurama that I''ve seen.

Ben


IcarusIndie.com [ The Labyrinth | DevZone | The Wall | Hosting | Tiberian Merchandise | GameShot | Fun With Cutouts ]

This topic is closed to new replies.

Advertisement