views:

99

answers:

2

Hey everyone, I don't know whether my title is correctly articulated, but I have following problem:

I have a self-written Java webserver, that handles incoming client requests. It works fine with all the request methods (GET, POST, HEAD, OPTIONS, DELETE, ...). It also works fine with sending files and stuff when I use http. GET and POST also work when I call a page over https, but all the other request methods do not work (Nothing has changed within in the Javascript, that sends the requests to the server ... it just runs with SSL). I can't seem to find anything as to why that is the case. Do the request methods work differently when I add SSL? I thought it is merely an addition to make the communication more safe? Am I wrong?

EDIT: There are also differences between different browsers ... most don't even get to send the request, chrome got to readyState = 4 :( btw, I tested with Chrome 2.0, Firefox 3.0.11, Opera 9.63, IE7, IE8, Safari 3.2.1.

Hope someone can shed some light.

Thnx in advance!

... doro

+1  A: 

The request methods should work the same, as you expect be it HTTP or HTTPS.

It is really difficult for us to help you out because

  1. you have a home grown web server which nobody knows but you, and
  2. you've not included any error message from the client or logs from the server. "other request methods do not work" is just not descriptive enough. You are going to have to be much more detailed than that.

Assuming a connection issue, my I suggest you try your client on a well know web server to see if it can connect? The problem could be in the client.

Stu Thompson
as to 1.: if you say that http and https doesn't change how requests work than it is obsolete to know exactly how the server works, especially if GET and POST get through (as mentioned above). so the problem must be somewhere else.as to 2.: there are none ... so nothing to include ... if I had an error message, don't you think I would include it? It seems that the function is not even called up ... I tried to debug it, but my functions are not called as my POST- and GET-requests via js-functions (which work perfectly fine both with http and https ... but I mentioned that before).
doro
edit: functions are being called, but it stops at an still (to me) unknown point :(
doro
A: 

The problem was in the call for the function!

The function is defined as follows:

function getHead( url, targetDiv ){
    // generate the HTTPREQUESTOBJECT ... let's call it 'req'
    req.open( "HEAD", url, true );
    // some more magic happens with the response
}

I changed the call for the function from:

onclick="getHead( 'http://localhost/Home', 'optionsdiv' )

to:

onclick="getHead( 'localhost/Home', 'optionsdiv' )

The first call is of course only for http, not for https! so switching that made it work :) Another method I found to work as well, was following: I add a try-catch like this:

try{
    req.open( "HEAD", "https://"+url, true );
}
catch( err ){
    req.open( "HEAD", "http://"+url, true );
}

Works almost perfectly on my end excpet the little browser-differences which drive me nuts!

doro