URLConnection getHeaderField problem

Normally, the header returned by URLConnection.getHeaderField(0) will return the http response code:
HTTP/1.0 200 OK
The response from this site:
is unknown/unknown
When I checked the first lines of the header using a socket, I found that the server actually returned:
HTTP 200 Document follows
I guess the lack of a version is confusing java. Is this a valid response ? Does the server have to include a version, or is there a problem in whatever URLConnection uses to parse the HTTP response ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HTTP Trace Applet

Accept: */*
Connection: Keep-Alive
Host: satc.gsfc.nasa.gov:80

HTTP/1.0 200 OK
Date: Wed, 02 Feb 2000 03:06:57 GMT
Server: NCSA/1.5.2
Last-Modified: Thu, 06 Jan 2000 17:44:19 GMT
Content-Type: text/html
Content-Length: 4804
Age: 16
Connection: keep-alive

also look
  (Sect. 15) How do I get a URLConnection to work through proxy firewalls? I.e.
  How do you get your application to do its web accesses through a proxy?
   This is typically needed for any net access to another domain. Tell the run
  time system what you are trying to do, by using these commandline arguments
  when you start the program.

java -DproxySet=true -DproxyHost=SOMEHOST -DproxyPort=SOMENUM  classname

  Note proxyPort is optional and it defaults to 80. Without this, you will see
  an exception like java.net.UnknownHostException or
  The proxy settings work for both java.net.URLConnection, and for
  Netscape's and IE's JVMs (at least in versions 4.x+) take the proxy settings
  for applets from the browser's proxy configuration. You can also do URL
  proxies in applications (not applets) with the following code
    // set up to use proxy
    System.getProperties().put("proxySet", "true");
    System.getProperties().put("proxyHost", "myproxy.server.name");
    System.getProperties().put("proxyPort", "80");
  But how do I know the name of the proxy server?
  This code just tells you how you can get a URL connection to the outside.
  Since it is your proxy server, you are expected to know the name of it. There
  isn't any code that you can write that will allow arbitrary URL connections to
  be initiated from outside the firewall. Think about it! If there were, the
  firewall would not be doing its job.
  Also note there are corresponding socksProxyPort and socksProxyHost for when
  socks is used instead of proxy. The default socks port is 1080.

Netscape FAQ
3.1: How do I use URLConnection through a proxy?
You may be getting the error:  #Security Exception: socket.connect:my.host.net->my.host.net. when using a proxy through a firewall, especially when specifying the CODEBASE property of the APPLET tag.  Try using the IP address as the CODEBASE specification instead of your domain name. 4.0 will handle proxies transparently.  [4.0]

Java Tip 42: Write Java apps that work with proxy-based firewalls

CsProxy (a free proxy server)

Firewall Access in Java Applets


Access Cookies from a Java Applet

SOCKS in IE4 and jview

Properties p = System.getProperties();
if (System.getProperty("java.vendor").equals("Microsoft Corp.")) {

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>> Does the server have to include

as far a s I remember the server MUST return the HTTP version.
you can get the HTTP protocol definiton from www.faqs.org (check the STD section)
cwinemanAuthor Commented:
Thanks for the answers.

My real problem is that when I try to open a URLConnection to that site, get the inputStream and read, it doesn't start with the content.
Normally the first bytes read from an html page will be "<html><head>...". On this site, the first things I read are:
HTTP 200 Document follows
.....other headers

I wasn't sure if it was because the server was doing something wrong, or java was screwing up reading the http response. I sounds like its the server according to heyhey.

The headers that vlad21 got are different than the ones that URLConnection gets. I think URLConnection must use a more simple "GET" request.

I'm not sure how to get around this using any standard java code. Looks like I need to find some other http client.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

cwinemanAuthor Commented:

Thanks for the info. The link on getting around a proxy server was helpful, but the link to the HTTP client appears to be broken. I am interested in finding another HTTP client if you know the address.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.