cfhttp.set(HTTP_VERSION,(rsp.getProtocolVersion()));
//responseHeader
railo.commons.net.http.Header[] headers = rsp.getAllHeaders();
StringBuffer raw=new StringBuffer(rsp.getStatusLine()+" ");
Struct responseHeader = new StructImpl();
Struct cookie;
Array setCookie = new ArrayImpl();
Query cookies=new QueryImpl(new String[]{"name","value","path","domain","expires","secure","httpOnly"},0,"cookies");
for(int i=0;i<headers.length;i++) {
railo.commons.net.http.Header header=headers[i];
//print.ln(header);
raw.append(header.toString()+" ");
if(header.getName().equalsIgnoreCase("Set-Cookie")) {
setCookie.append(header.getValue());
parseCookie(cookies,header.getValue());
}
else {
//print.ln(header.getName()+"-"+header.getValue());
Object value=responseHeader.get(KeyImpl.getInstance(header.getName()),null);
if(value==null) responseHeader.set(KeyImpl.getInstance(header.getName()),header.getValue());
else {
Array arr=null;
if(value instanceof Array) {
arr=(Array) value;
}
else {
arr=new ArrayImpl();
responseHeader.set(KeyImpl.getInstance(header.getName()),arr);
arr.appendEL(value);
}
arr.appendEL(header.getValue());
}
}
// Content-Type
if(header.getName().equalsIgnoreCase("Content-Type")) {
mimetype=header.getValue();
if(mimetype==null)mimetype=NO_MIMETYPE;
}
// Content-Encoding
if(header.getName().equalsIgnoreCase("Content-Encoding")) {
contentEncoding=header.getValue();
}
}
cfhttp.set(RESPONSEHEADER,responseHeader);
cfhttp.set(KeyConstants._cookies,cookies);
responseHeader.set(STATUS_CODE,new Double(rsp.getStatusCode()));
responseHeader.set(EXPLANATION,(rsp.getStatusText()));
if(setCookie.size()>0)responseHeader.set(SET_COOKIE,setCookie);
// is text
boolean isText=
mimetype == null ||
mimetype == NO_MIMETYPE || HTTPUtil.isTextMimeType(mimetype);