What are the web servers that power the internet?

So how can you tell what server is being used to run a website? Here is a simple Java program that can help one figure out the kind of server that serves a particular website.

package whataretheyrunning;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/\*\*
 \*
 \* @author octav
 \*/
public class SnoopURL {

    String URLString = null;

    public SnoopURL(String URLString) {
        this.URLString = URLString;
    }

    public void snoop() {
        try {
            // build URL
            URL url = new URL(URLString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestMethod("GET";);
            conn.setDoOutput(true);

            // start talking
            conn.connect();

            // int length = conn.getContentLength();
            // System.out.println(" \*\*\*\* the length of the content is " + length + " for URL " + URLString);

            System.out.println(" \*\*\*\* Server type is:  " + conn.getHeaderField("Server";) + "\\n\\n";);

            // get more information
            Map map = conn.getHeaderFields();
            for (int i = 0; i < map.size(); i++) {
                System.out.println(" \*\*\*\* " + conn.getHeaderField(i));
            }

            // cleanup
            conn.disconnect();
        } catch (MalformedURLException ex) {
            Logger.getLogger(SnoopURL.class.getName()).log(Level.SEVERE, null, ex);
        } catch (java.io.IOException ioe) {
            ioe.printStackTrace();
        } finally {
            // do whatever cleanup ...
        }
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    @Override
    public String toString() {
        return super.toString();
    }
}

The output of this program is something like this:

\*\*\*\* Server type is: Sun-Java-System-Web-Server/6.1

\*\*\*\* HTTP/1.1 200 OK
\*\*\*\* Sun-Java-System-Web-Server/6.1
\*\*\*\* Mon, 18 Feb 2008 04:46:48 GMT
\*\*\*\* text/html;charset=UTF-8
\*\*\*\* policyref="http://www.sun.com/p3p/Sun_P3P_Policy.xml", CP="CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV"
\*\*\*\* Servlet/2.4,JSP/2.0
\*\*\*\* chunked
\*\*\*\* Starload=star-fep5; Path=/
 

Now let's look at some popular websites.

Sun's www.sun.com is using the old Web Enterprise server, version 6.1 (the same is true for java.sun.com). The site the publishes this blog: blogs.sun.com is powered by Sun-Java-System-Web-Server/7.0 (a newer version of the same web server). Google seems to use their own version: gws. Yahoo does not tell you (returns null). Microsoft eats their own dog food: Microsoft-IIS/7.0. Nice. IBM runs something called: IBM_HTTP_Server (I bet is Apache's web server).



 

Comments:

I use netcraft: http://uptime.netcraft.com/up/graph?site=

Posted by Rayson on February 17, 2008 at 01:34 PM PST #

Very cool site. I could have saved myself some time :-).

Posted by Octavian on February 18, 2008 at 01:52 AM PST #

% curl -I www.sun.com
;)

Posted by Alexis MP on February 23, 2008 at 05:10 AM PST #

Post a Comment:
Comments are closed for this entry.
About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today