Changeset 192

Show
Ignore:
Timestamp:
04/23/07 14:14:29 (6 years ago)
Author:
robert
Message:

changed jala.Test.HttpClient? to correctly handle multiple cookies received from the remote server (see http://helma.org/bugs/show_bug.cgi?id=509 for details)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • jala/trunk/util/Test/code/Global/jala.Test.js

    r162 r192  
    932932jala.Test.HttpClient = function() { 
    933933   var client = new helma.Http(); 
    934    var cookie = null; 
     934   var cookies = null; 
    935935 
    936936   /** 
     
    945945   /** 
    946946    * Sets the cookie to use for subsequent requests using this client 
    947     * @param {Object} c The cookie object as received from helma.Http.getUrl 
     947    * @param {Array} arr The cookie object as received from helma.Http.getUrl 
    948948    */ 
    949    this.setCookie = function(c) { 
    950       cookie = c; 
     949   this.setCookies = function(arr) { 
     950      cookies = arr; 
    951951      return; 
    952952   }; 
    953953 
    954954   /** 
    955     * Returns the cookie set for this http client 
     955    * Returns the cookies set for this http client 
     956    * @returns The cookies to use for subsequent requests 
     957    * @type Array 
    956958    */ 
    957    this.getCookie = function() { 
    958       return cookie; 
     959   this.getCookies = function() { 
     960      return cookies; 
    959961   }; 
    960962 
     
    973975   var client = this.getClient(); 
    974976   client.setMethod(method); 
    975    var cookie = this.getCookie(); 
    976    if (cookie != null) { 
    977        client.setCookie(cookie.name, cookie.value); 
    978    } 
     977   client.setCookies(this.getCookies()); 
    979978   // prevent any caching at the remote server or any intermediate proxy 
    980979   client.setHeader("Cache-control", "no-cache,max-age=0"); 
     
    984983   client.setFollowRedirects(false); 
    985984   var result = client.getUrl(url); 
    986    if (result.cookie != null) { 
    987       this.setCookie(result.cookie); 
     985   if (result.cookies != null) { 
     986      this.setCookies(result.cookies); 
    988987   } 
    989988   if (result.location != null) {