Thursday, October 30, 2008

How to Telnet to a Web Server - HTTP Requests through Telnet

A web server, responding to a HTTP GET request sends the required content to the client. Normally we don't see what is sent between the web client and the server. However we can easily see what is sent by the server by telneting to that web server.

To connect to the web server - open a command line and type the command
telnet host port
eg. telnet 80

Then you'll get connected to the particular web server and then you can enter any HTTP command you want such as GET, HEAD.

If you need to request for a web page from the web server you can type the HTTP request as follows.

GET pageName HTTP/1.0
eg. GET /products HTTP/1.0

Hit enter twice. Then you will get a response (if page exists)as follows.

HTTP/1.0 200 OK
Date: Thu, 30 Oct 2008 18:17:16 GMT
Server: Apache/2.2.9
X-Powered-By: PHP/5.2.6
Set-Cookie: PHPSESSID=5322082bf473207961031e3df1f45a22; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=UTF-8

content goes here


You'll get a 404 status if page not found, 301 if the page is moved permanently and 401 if you are not authorized to access the page. More HTTP status codes can be found here.

You can follow a similar way to issue other HTTP commands with the relevant content.

Monday, October 06, 2008

How to Play .ram Files in Ubuntu

Files having the .ram extension actually don't give any meaning to the word "Play" as they are realplayer meta files only, referring to the actual audio files. To play .ram files you should be connected to the Internet as they are streamed and played.

In Ubuntu, you can get a .ram file to play by following the steps below.

1. Install Realplayer and the plugin for Mozilla Firefox. (The way to install is well described in Ubuntu - Hardy user guide)

2. Grab the URL inside the .ram file.

3. Create a .html page including a single line containing the URL. (ex. <a href="">My file</a>).

4. Open the html page and just click on the link - My file.
Related Posts with Thumbnails