title: HttpGet/Client and HTTPS
body: <p>Previously, I used custom TrustManager talked about <a href="http://ws.apache.org/xmlrpc/ssl.html" rel="nofollow">here</a> to do this</p>
  
  <pre><code>SAXParserFactory spf = SAXParserFactory.newInstance();
  SAXParser sp = spf.newSAXParser();
  
  XMLReader xr = sp.getXMLReader();
  MyXMLHandler mHandler = new MyXMLHandler();
  xr.setContentHandler(mHandler);
  
  xr.parse(new InputSource(buildUrlString()));
  </code></pre>
  
  <p>(where buildUrlString() returns a string containing the https:// url to call) which works fine.  However, I want to now be able to send the same url an Accept-Encoding header for gzip compression.  I can do that like this</p>
  
  <pre><code>HttpUriRequest request = new HttpGet(buildUrlString());
  request.addHeader("Accept-Encoding", "gzip");
  HttpClient httpClient = new DefaultHttpClient();
  HttpResponse response = httpClient.execute(request);
  
  InputStream instream = response.getEntity().getContent();
  Header contentEncoding = response.getFirstHeader("Content-Encoding");
  if ((contentEncoding != null)
      &amp;&amp; contentEncoding.getValue().equalsIgnoreCase("gzip")) 
  { 
    instream = new GZIPInputStream(instream);
  } 
  xr.parse(new InputSource(instream));
  </code></pre>
  
  <p>but that brings back the "Not trusted server certificate" error that I want to ignore.  How do I make it do HTTPS?  Alternatively, is there a better way to do this?  (And is there something I need to check first to make sure the phone really can accept the gzipped webpages that I'm saying it can?)</p>