Reference: http://stackoverflow.com/questions/3730760/https-returns-404-with-defaulthttpclient-on-android

I have an http request that worked as http://blah.com and now I have been asked to usehttps://blah.com

The former works and the later fails with a Network I/O error. Are there any missing parameter settings that I need for the client?

 

Answer

Https almost always implies a different port being used (standard http=>80; standard https=>443). You have a hardcoded port (8151). I'm guessing the https servlet is listening on a different port.

 

Suggestion:

 

 

Hardcode HTTPS port number after the url.

 

 

For example:

 

 

private static final String URL = "https://www.blah.com:443";

創作者介紹

資訊園

shadow 發表在 痞客邦 PIXNET 留言(0) 人氣()