var HTTPHeaders = function() {
}

//-------------------------------------------------------------------------------
HTTPHeaders.prototype.completionStatus = 0;
HTTPHeaders.prototype.getCompletionStatus = function () {return this.completionStatus;};
HTTPHeaders.prototype.setCompletionStatus = function (completionStatus) {this.completionStatus = completionStatus;};
//-------------------------------------------------------------------------------
HTTPHeaders.prototype.debugging = false;
HTTPHeaders.prototype.getDebugging = function () {return this.debugging;};
HTTPHeaders.prototype.setDebugging = function (debugging) {this.debugging = debugging;};
//-------------------------------------------------------------------------------
HTTPHeaders.prototype.httpHeadersLog;
HTTPHeaders.prototype.getLog = function () {return this.httpHeadersLog;};
HTTPHeaders.prototype.setLog = function (httpHeadersLog) {this.httpHeadersLog = httpHeadersLog;};
//-------------------------------------------------------------------------------
HTTPHeaders.prototype.headers;
HTTPHeaders.prototype.getHeaders = function() {return this.headers;}
HTTPHeaders.prototype.setHeaders = function(headers) {
 this.headers = headers;
 this.splitHeaders();
 return 1;
}
//-------------------------------------------------------------------------------
HTTPHeaders.prototype.httpHeadersStringArray;
HTTPHeaders.prototype.getHTTPHeadersStringArray = function () {return this.httpHeadersStringArray;};
HTTPHeaders.prototype.getHTTPHeadersStringArray = function (httpHeadersStringArray) {this.httpHeadersStringArray = httpHeadersStringArray;};
//-------------------------------------------------------------------------------
HTTPHeaders.prototype.httpHeadersArray = new Array();
HTTPHeaders.prototype.getHeader = function(name) {return this.httpHeadersArray[name];};
HTTPHeaders.prototype.setHeader = function(name, value) {this.httpHeadersArray[name] = value; return 1;};

//-------------------------------------------------------------------------------
HTTPHeaders.prototype.splitHeaders = function() {
 if(this.getDebugging() && this.getLog()) {this.getLog().println("HTTPHeaders.splitHeaders is running...");};
 this.httpHeadersArray = new Array();
 this.httpHeadersStringArray = this.headers.split("\n");
 this.httpHeadersStringArray.length;
 for(var i=0; i<this.httpHeadersStringArray.length; i++) {
  var splitPosition = this.httpHeadersStringArray[i].indexOf(":");
  if(splitPosition > 0) {
   var name = this.httpHeadersStringArray[i].slice(0, splitPosition);
   var value = this.httpHeadersStringArray[i].slice(splitPosition+1); 
   if(this.getDebugging() && this.getLog()) {this.getLog().println(name+"=\""+value+"\"");};
   this.httpHeadersArray[name] = value;
  };
 }
}