title: Android EOFException when using HttpURLConnection headers
body: <p>I sign my http request with a custom authorization header:</p>
  
  <pre><code>String key="client="+USER+",hash="+sha1(STR, API_KEY)+",timestamp="+t.toString();
  </code></pre>
  
  <p>If anybody is interested in the sha1 method: <a href="http://pastebin.com/HRFXQ4Bk" rel="nofollow">http://pastebin.com/HRFXQ4Bk</a> The key string is used as header:</p>
  
  <pre><code>URL url = new URL(sb.toString());
  
  HttpURLConnection conn = null;  
  conn = (HttpURLConnection) url.openConnection();
  conn.setRequestProperty("Authorization", key);
  conn.setRequestMethod("GET");
  
  InputStreamReader in = new InputStreamReader(conn.getInputStream());
  </code></pre>
  
  <p>When I try to get the response I get following error:</p>
  
  <blockquote>
    <p>10-28 18:25:40.111: E/error(6855): java.io.EOFException 10-28
    18:25:40.111: E/error(6855):  at
    libcore.io.Streams.readAsciiLine(Streams.java:203) 10-28 18:25:40.111:
    E/error(6855):    at
    libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
    10-28 18:25:40.111: E/error(6855):    at
    libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) 10-28
    18:25:40.111: E/error(6855):  at
    libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
    10-28 18:25:40.111: E/error(6855):    at
    libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)</p>
  </blockquote>
  
  <p>On my server no access was logged by this request. However when I remove the auth header a connection to my server is established according to the server log. </p>
  
  <p>So how does the auth header influence the request? Why is there no connection when using header?</p>
  
  <hr>
  
  <p>BTW a header like </p>
  
  <pre><code>conn.setRequestProperty("Authorization", "FOOBAR");
  </code></pre>
  
  <p>works, however is refused because the authorization header does not match the requirements:</p>
  
  <blockquote>
    <p>10-29 08:12:07.235: E/error(23663): java.net.ConnectException: failed
    to connect to api.myserver.net (port 1337):
    connect failed: ECONNREFUSED (Connection refused) 10-29 08:12:07.235:
    E/error(23663):   at libcore.io.IoBridge.connect(IoBridge.java:114)
    10-29 08:12:07.235: E/error(23663):   at
    java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 10-29
    08:12:07.235: E/error(23663):     at
    java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)</p>
  </blockquote>
  
  <p>My webservice requires the header to have following format</p>
  
  <pre><code>match(/client=([^,]*),hash=([^,]*),timestamp=([^,]*)/);
  </code></pre>
  
  <p>So this exception is different from the initial exception. When I remove the header and disable authorization on my webservice the connection works as expected. So the problem seems to be with the custom authorization header. Any ideas?</p>