hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jake C" <buddhabu...@hotmail.com>
Subject https now works, but http doesnt?!?!
Date Sat, 02 Dec 2006 05:05:49 GMT
Thanks for all the earlier help! I now have https working.

Strangely enough, however, it now fails to work for http... :-(

I am most positive it doesn't have anything to do with using EasySSL*, 
because if I comment it all out, I still have the problem with http, and 
also can't connect to https any more.

When I run under https, I get a log message that I used to get for http as 
well:
[INFO] HttpMethodDirector - Redirect requested but followRedirects is 
disabled
I was never sure WHY I got that message, as I always called 
method.setFollowRedirects(false) and follow the redirects manually. However, 
it didn't seem to hurt anything, so I ignored it.

However, now when I use http, I get this message instead:
[INFO] HttpMethodBase - Discarding unexpected response: HTTP/1.1 100 
Continue
I then get a 405, Method not allowed error and some really strange HTML as a 
response, which I'm sure is just the standard IIS 405 error page, but since 
it mentions protocol, I'll include it at the bottom of the message.

I am POSITIVE I am using the correct url. It DOES have a port, but I've been 
using this exact same code before I added the EasySSL* classes, and it 
worked just fine. If I manually browse to the same page, I can log in.

I print out the path beforehand, and it is the same for both protocols, and 
the PostMethod is created identically as well. I originally added the 
EasySSL* stuff no matter what protocol was being used, as follows:
    	Protocol easyhttps = new Protocol("https", new 
EasySSLProtocolSocketFactory(), 443);
    	Protocol.registerProtocol("https", easyhttps);

I then removed those lines completely, in case having that set somehow 
messed up http, but http still failed.

Actually, there IS one thing I changed from before. I made my HttpClient 
static and access it in synchronized(client) blocks now. My application is 
user-bound, and one interaction is always completed before they can start 
another anyway, but I added the synchronized blocks for safety. That 
couldn't really cause problems, could it? I'm not locking up, just getting 
an error from the server.

Here is the HTML page I received.

<META NAME="ROBOTS" CONTENT="NOINDEX">

<title>The page cannot be displayed</title>

<META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
</head>

<script>
function Homepage(){
<!--
// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm

	//For testing use DocURL = 
"res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
	DocURL=document.URL;

	//this is where the http or https will be, as found by searching for :// 
but skipping the res://
	protocolIndex=DocURL.indexOf("://",4);

	//this finds the ending slash for the domain server
	serverIndex=DocURL.indexOf("/",protocolIndex + 3);

	//for the href, we need a valid URL to the domain. We search for the # 
symbol to find the begining
	//of the true URL, and add 1 to skip it - this is the BeginURL value. We 
use serverIndex as the end marker.
	//urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
	BeginURL=DocURL.indexOf("#",1) + 1;
	urlresult=DocURL.substring(BeginURL,serverIndex);

	//for display, we need to skip after http://, and go to the next slash
	displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
	InsertElementAnchor(urlresult, displayresult);
}

function HtmlEncode(text)
{
    return text.replace(/&/g, '&amp').replace(/'/g, '&quot;').replace(/</g,

'&lt;').replace(/>/g, '&gt;');
}

function TagAttrib(name, value)
{
    return ' '+name+'="'+HtmlEncode(value)+'"';
}

function PrintTag(tagName, needCloseTag, attrib, inner){
    document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner) );
    if (needCloseTag) document.write( '</' + tagName +'>' );
}

function URI(href)
{
    IEVer = window.navigator.appVersion;
    IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 );

    return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ?
        encodeURI(href) :
        escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';');
}

function InsertElementAnchor(href, text)
{
    PrintTag('A', true, TagAttrib('HREF', URI(href)), text);
}

//-->
</script>

<body bgcolor="FFFFFF">

<table width="410" cellpadding="3" cellspacing="5">

  <tr>
    <td align="left" valign="middle" width="360">
	<h1 style="COLOR:000000; FONT: 13pt/15pt verdana"><!--Problem-->The page 
cannot be displayed</h1>
    </td>
  </tr>

  <tr>
    <td width="400" colspan="2">
	<font style="COLOR:000000; FONT: 8pt/11pt verdana">The page you are looking 
for cannot be displayed because the page address is incorrect.</font> </td>
  </tr>

  <tr>
    <td width="400" colspan="2">
	<font style="COLOR:000000; FONT: 8pt/11pt verdana">

	<hr color="#C0C0C0" noshade>

    <p>Please try the following:</p>

	<ul>
      <li>If you typed the page address in the Address bar, check that it is 
entered correctly.<br>
      </li>

       <li>Open the

	   <script>
	   <!--
	   if (!((window.navigator.userAgent.indexOf("MSIE") > 0) && 
(window.navigator.appVersion.charAt(0) == "2")))
	   {
	   	 Homepage();
	   }
	   //-->
	   </script>

	   home page and then look for links to the information you want.</li>
    </ul>

    <h2 style="COLOR:000000; FONT: 8pt/11pt verdana">HTTP 405 - Resource not
    allowed<br>
    Internet Information Services</h2>

	<hr color="#C0C0C0" noshade>

	<p>Technical Information (for support personnel)</p>

<ul>
<li>More information:<br>
<a 
href="http://www.microsoft.com/ContentRedirect.asp?prd=iis&sbp=&pver=5.0&pid=&ID=405&cat=web&os=&over=&hrd=&Opt1=&Opt2=&Opt3="

target="_blank">Microsoft Support</a>
</li>
</ul>

    </font></td>
  </tr>

</table>
</body>
</html>

Thanks in advance for any help!

_________________________________________________________________
Get the latest Windows Live Messenger 8.1 Beta version. Join now. 
http://ideas.live.com


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message