Why does Java force user-agent through simple Socket IO?

Posted by Zombies on Stack Overflow See other posts from Stack Overflow or by Zombies
Published on 2010-05-01T04:18:31Z Indexed on 2010/05/01 4:27 UTC
Read the original article Hit count: 236

I am using nothing but raw Socket IO. There isn't one HttpURLConnection nor any http client libs in my project. When I run it through wireshark I see somethign very revealing:

GET / HTTP/1.1

User-Agent: Java/1.6.0_15

Host: www.google.com

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

Here is the crazy part, I never put ANY of that in my original request. My original request was:

        "GET http://www.google.com/ HTTP/1.1\r\n" +
        "Host: www.google.com\r\n" +
        "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8\r\n" +
        "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" +
        "Accept-Language: en-us,en;q=0.5\r\n" +
        "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" +
        "Keep-Alive: 300\r\n" +
        "\r\n";

I am using the default Sun JVM.

© Stack Overflow or respective owner

Related posts about java

Related posts about user-agent