title: HttpURLConnection in android doesn't send correct User-Agent header
body: <p>I have found an issue. I have a server that uses User Agent header to identify the device that is connecting to it. But when i connect to the server using HttpURLConnection i get no User Agent header, but when i connect with the browser it sends the correct User Agent.</p>
  
  <p>For testing i am using an echo server that replies with the headers it found on the request.</p>
  
  <p>When i connect with browser i get:
  eg: User-Agent: Mozilla/5.0 (Linux; U; Android 1.5; en-fr; HTC Hero Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1 Up.Link/6.3.1.20.06.3.1.20.0.</p>
  
  <p>But when i connect by code with UrlConnection i get:</p>
  
  <p>User-Agent: UNAVAILABLE.</p>
  
  <p>Does anyone know we i get different behaviors? How i can i connect in the same way the browser does?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>What i really need is not only the User-Agent header, i also need some special headers (x-up-subno actually). This header is added by the APN of the operator, but for some reason when i connect by code that headers are not added to the request.</p>
  
  <p>From browser:
  <a href="https://i.stack.imgur.com/CffhC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CffhC.png" alt="browser"></a></p>
  
  <p>From code:
  <a href="https://i.stack.imgur.com/SSHa9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSHa9.png" alt="code"></a></p>
  
  <p>Thanks,</p>