how to use getAllResponseheaders() method



  • It would be a GREAT lecture tutorial if you made one.

    "If sessionId expires in a day or after few hours then you have to make one request for accepting the terms which sends jsessionId in cookie."

    Keep-Alive: timeout=15, max=100

    The session times out in 15 with a maximum of 100 requests.

    TASK 1:  Then you have to parse it using http.getAllResponseheaders() method

    https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders

    var request = new XMLHttpRequest();
    request.open("GET", "foo.txt", true);
    request.send();
    request.onreadystatechange = function() {
    if(this.readyState == this.HEADERS_RECEIVED) {
    console.log(request.getAllResponseHeaders());
    }
    }

    Please, how would I do this?

    I am viewing the XHR in developer tab, network.  I am copying the session cookie.

    TASK 2:  and use it in further POST requests

    How would this cookie be captured and used within the code for reuse?

    TASK 3: when you click submit button of a web form, browser collects all values from web form inputs and send them within XHR as parameters.

    The input form values variables are set but not being SENT, why is it not being sent?

    NOTES: Open the first XHR, there are request and response headers, and parameters parts, in request header you can find URL and cookies, in parameters you can find the data sent to the server.

    Response tab contains the result.

    If cookies are mandatory (server returns crap with omitted cookies response) then better to use MSXML2.ServerXMLHTTP or WinHttp.WinHttpRequest.5.1 to handle cookies, MSXML2.XMLHTTP hides cookies from the user.


  • administrators

    Session expiration has nothing to do with Keep-alive header. Everything else is answered in the code I sent you over email.


Log in to reply
 

Looks like your connection to Codingislove Forum was lost, please wait while we try to reconnect.