mcardle 2006/01/06 02:11:07 CET
Modified files:
src/org/jahia/esi Utils.java
Log:
* doesn't copy over Host header
Revision Changes Path
1.17 +22 -16 esi_server/src/org/jahia/esi/Utils.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/Utils.java.diff?r1=1.16&r2=1.17&f=h
Index: Utils.java
===================================================================
RCS file: /home/cvs/repository/esi_server/src/org/jahia/esi/Utils.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Utils.java 14 Dec 2005 16:46:02 -0000 1.16
+++ Utils.java 6 Jan 2006 01:11:07 -0000 1.17
@@ -67,21 +67,6 @@
public static String jahiaEsiServerBuildNumber = "0.1";
- public static GetMethod copyMethod ( HttpMethod method) {
- try {
- //TODO: expand to other methods than GetMethod
- GetMethod newMethod = new GetMethod(method.getURI().toString());
//constructor assumes URL is escaped
-
- copyRequestHeaders(method, newMethod);
- addEsiRequestHeaders(newMethod);
-
- return newMethod;
- }
- catch (Exception e) {
- log.error("copyMethod error method:"+method + " excp:"+e);
- }
- return null;
- }
public static boolean isCacheUrlParamPresent(String url) {
if (url !=null && (
@@ -161,12 +146,33 @@
return newUrls;
}
+ public static GetMethod copyMethod ( HttpMethod method) {
+ try {
+ //TODO: expand to other methods than GetMethod
+ GetMethod newMethod = new
GetMethod(method.getURI().toString()); //constructor assumes URL is escaped
+
+ copyRequestHeaders(method, newMethod);
+ addEsiRequestHeaders(newMethod);
+
+ return newMethod;
+ }
+ catch (Exception e) {
+ log.error("copyMethod error method:"+method + " excp:"+e);
+ }
+ return null;
+ }
+
public static void copyRequestHeaders(HttpMethod source, HttpMethod
target) throws HttpException {
Header[] requestHeaders = source.getRequestHeaders();
for (int i=0; i< requestHeaders.length; i++ ) {
- target.setRequestHeader(requestHeaders[i]);
+ Header header = requestHeaders[i];
+ String name = header.getName();
+ String val = header.getValue();
+
+ if (!name.equalsIgnoreCase("host"))
+ target.setRequestHeader(requestHeaders[i]);
}
//TODO:check banned headers (got to RequestHAndlerBAse for details)