diff --git a/pom.xml b/pom.xml
index 7a9699d086e4a06c2ffdc6916e94e294038869b2..baf27190bed26f74fd733ee58c91632a33e86bfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1965,12 +1965,12 @@
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpcore</artifactId>
-			<version>4.3</version>
+			<version>4.3.1</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpclient</artifactId>
-			<version>4.3</version>
+			<version>4.3.1</version>
 			<exclusions>
 				<exclusion>
 					<groupId>commons-logging</groupId>
@@ -1981,7 +1981,7 @@
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpmime</artifactId>
-			<version>4.3</version>
+			<version>4.3.1</version>
 		</dependency>
 		<dependency>
 			<groupId>commons-lang</groupId>
diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
index 92eeda2d07131f82afefdcae6e1c22e57acf359d..373aeb63518fb78bf34bbed5aa2b62e7ff8a9335 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
@@ -72,7 +72,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 	private boolean enableTextmarking;
 	private boolean adjusteightAutomatically;
 	
-	private String g_encoding;
 	private String jsEncoding;
 	private String contentEncoding;
 
@@ -93,7 +92,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 	}
 	
 	public IFrameDeliveryMapper(VFSItem rootDir, boolean rawContent, boolean enableTextmarking, boolean adjusteightAutomatically,
-			String g_encoding, String jsEncoding, String contentEncoding,
 			String frameId, String customCssURL, String themeBaseUri, String customHeaderContent) {
 		
 		this.rootDir = rootDir;
@@ -102,10 +100,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 		this.enableTextmarking = enableTextmarking;
 		this.adjusteightAutomatically = adjusteightAutomatically;
 		
-		this.g_encoding = g_encoding;
-		this.jsEncoding = jsEncoding;
-		this.contentEncoding = contentEncoding;
-		
 		this.frameId = frameId;
 		this.customCssURL = customCssURL;
 		this.themeBaseUri = themeBaseUri;
@@ -121,7 +115,7 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 			}
 			openolatCss = config.getOpenolatCss();
 			if(config.getContentEncoding() != null) {
-				g_encoding = config.getContentEncoding();
+				contentEncoding = config.getContentEncoding();
 			}
 			if(config.getJavascriptEncoding() != null) {
 				jsEncoding = config.getJavascriptEncoding();
@@ -202,13 +196,16 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 			if (path.toLowerCase().lastIndexOf(FILE_SUFFIX_HTM) >= (path.length()-4)) {
 				// set the http content-type and the encoding
 				Page page = loadPageWithGuess(vfsLeaf);
-				g_encoding = page.getEncoding();
+				String pageEncoding = page.getEncoding();
 				if (page.isUseLoadedPageString()) {
-					mr = prepareMediaResource(httpRequest, page.getPage(), g_encoding, page.getContentType(), isPopUp);
+					mr = prepareMediaResource(httpRequest, page.getPage(), pageEncoding, page.getContentType(), isPopUp);
 				} else {
 					// found a new charset other than iso-8859-1, load string with proper encoding
-					String content = FileUtils.load(vfsLeaf.getInputStream(), g_encoding);
-					mr = prepareMediaResource(httpRequest, content, g_encoding, page.getContentType(), isPopUp);
+					String content = FileUtils.load(vfsLeaf.getInputStream(), pageEncoding);
+					mr = prepareMediaResource(httpRequest, content, pageEncoding, page.getContentType(), isPopUp);
+				}
+				if(contentEncoding == null) {
+					contentEncoding = pageEncoding;
 				}
 			} else if (path.endsWith(FILE_SUFFIX_JS)) { // a javascript library
 				VFSMediaResource vmr = new VFSMediaResource(vfsLeaf);
@@ -218,8 +215,11 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 				// together with the mime-type, which is wrong.
 				// so we assume the .js file has the same encoding as the html file
 				// that loads the .js file
-				if (jsEncoding != null) vmr.setEncoding(jsEncoding);
-				else if (g_encoding != null) vmr.setEncoding(g_encoding);
+				if (jsEncoding != null) {
+					vmr.setEncoding(jsEncoding);
+				} else if (contentEncoding != null) {
+					vmr.setEncoding(contentEncoding);
+				}
 				mr = vmr;
 			} else {
 				// binary data: not .html, not .htm, not .js -> treated as is
@@ -505,7 +505,7 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 		return cType;
 	}
 	
-	private String guessEncoding(String content) {
+	protected String guessEncoding(String content) {
 		Matcher m = PATTERN_ENCTYPE.matcher(content);
 		if (m.find()) {
 			// use found char set
diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
index b3ce2bcf8cf14a873f792c4d85c9e3d3f11760d7..1293b6cfc182b6cd5af422e5edb59eb8f197d2ab 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
@@ -157,7 +157,6 @@ public class IFrameDisplayController extends BasicController implements GenericE
 		//TODO:gs may use the same contentMapper if users clicks again on the same singlePage, now each time a new Mapper gets created and 
 		//therefore the browser can not reuse the cached elements
 		contentMapper = new IFrameDeliveryMapper(rootDir, false, enableTextmarking, adjusteightAutomatically,
-				null /*g_encoding*/, null /*jsEncoding*/, null /*contentEncoding*/,
 				frameId, null /*customCssURL*/, themeBaseUri, null /*customHeaderContent*/);
 		contentMapper.setDeliveryOptions(options);
 
diff --git a/src/main/java/org/olat/core/gui/media/HttpRequestMediaResource.java b/src/main/java/org/olat/core/gui/media/HttpRequestMediaResource.java
index 6714b2870716469fdaa3230a7e4aba27b749da4e..1c10641d060d172d39d5091486566cd6697db204 100644
--- a/src/main/java/org/olat/core/gui/media/HttpRequestMediaResource.java
+++ b/src/main/java/org/olat/core/gui/media/HttpRequestMediaResource.java
@@ -26,6 +26,8 @@
 
 package org.olat.core.gui.media;
 
+import java.io.ByteArrayInputStream;
+import java.io.Closeable;
 import java.io.InputStream;
 import java.text.DateFormat;
 import java.text.ParseException;
@@ -34,13 +36,18 @@ import java.util.Date;
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.http.Header;
 import org.apache.http.HttpResponse;
+import org.olat.core.logging.OLog;
+import org.olat.core.logging.Tracing;
 
 /**
  * @author Mike Stock
  */
 public class HttpRequestMediaResource implements MediaResource {
+	
+	private static final OLog log = Tracing.createLoggerFor(HttpRequestMediaResource.class);
 
 	private final HttpResponse response;
 
@@ -78,7 +85,7 @@ public class HttpRequestMediaResource implements MediaResource {
 		try {
 			return response.getEntity().getContent();
 		} catch (Exception e) {
-			//  
+			log.error("", e);
 		}
 		return null;
 	}
@@ -107,7 +114,9 @@ public class HttpRequestMediaResource implements MediaResource {
 	 */
 	@Override
 	public void release() {
-		//response.getEntity()..releaseConnection();
+		if(response instanceof Closeable) {
+			IOUtils.closeQuietly((Closeable)response);
+		}
 	}
 
 	/**
@@ -124,6 +133,5 @@ public class HttpRequestMediaResource implements MediaResource {
 		} else {
 			hres.setHeader("Content-Disposition", "filename=" + h.getValue());
 		}
-		
 	}
 }
\ No newline at end of file
diff --git a/src/main/java/org/olat/modules/tu/TunnelMapper.java b/src/main/java/org/olat/modules/tu/TunnelMapper.java
index b26f49c1f782f29b546254424d88e2b79d8327b3..6227b4988f877dbabcad87a1a2d22995e2e44171 100644
--- a/src/main/java/org/olat/modules/tu/TunnelMapper.java
+++ b/src/main/java/org/olat/modules/tu/TunnelMapper.java
@@ -38,6 +38,7 @@ import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
 import org.olat.basesecurity.BaseSecurityModule;
 import org.olat.core.CoreSpringFactory;
 import org.olat.core.dispatcher.mapper.Mapper;
@@ -144,6 +145,7 @@ public class TunnelMapper implements Mapper {
 			Header responseHeader = response.getFirstHeader("Content-Type");
 			if (responseHeader == null) {
 				// error
+				EntityUtils.consumeQuietly(response.getEntity());
 				return new NotFoundMediaResource(relPath);
 			}
 			return new HttpRequestMediaResource(response);
@@ -154,7 +156,7 @@ public class TunnelMapper implements Mapper {
 			log.error("", e);
 			return null;
 		} catch (IOException e) {
-			log.error("", e);
+			log.error("Error loading URI: " + (meth == null ? "???" : meth.getURI()), e);
 			return null;
 		}
 	}
diff --git a/src/main/java/org/olat/search/ui/AdvancedSearchInputController.java b/src/main/java/org/olat/search/ui/AdvancedSearchInputController.java
index 3d820835b329472b16566ac963df890ea87c0c10..d40f17f9895e2d69944b2bc43ff7aa5b45ed212c 100644
--- a/src/main/java/org/olat/search/ui/AdvancedSearchInputController.java
+++ b/src/main/java/org/olat/search/ui/AdvancedSearchInputController.java
@@ -22,6 +22,7 @@ package org.olat.search.ui;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
@@ -235,10 +236,16 @@ public class AdvancedSearchInputController extends FormBasicController {
 			appendAnd(queries, AbstractOlatDocument.DESCRIPTION_FIELD_NAME, ":(", descriptionQuery.getValue(), ") ");
 	  }
 		if (StringHelper.containsNonWhitespace(createdDate.getValue())) {
-			appendAnd(queries, AbstractOlatDocument.CREATED_FIELD_NAME, ":(", format.format(createdDate.getDate()), ") ");
+			Date creationDate = createdDate.getDate();
+			if(creationDate != null) {
+				appendAnd(queries, AbstractOlatDocument.CREATED_FIELD_NAME, ":(", format.format(creationDate), ") ");
+			}
 	  }
 		if (StringHelper.containsNonWhitespace(modifiedDate.getValue())) {
-			appendAnd(queries, AbstractOlatDocument.CHANGED_FIELD_NAME, ":(", format.format(modifiedDate.getDate()), ") ");
+			Date modificationDate = modifiedDate.getDate();
+			if(modificationDate != null) {
+				appendAnd(queries, AbstractOlatDocument.CHANGED_FIELD_NAME, ":(", format.format(modificationDate), ") ");
+			}
 	  }
 		//Check for null on metadata element since it might not be configured and initialized
 		if (metadataQuery != null && StringHelper.containsNonWhitespace(metadataQuery.getValue())) {
diff --git a/src/main/java/org/olat/shibboleth/ShibbolethDispatcher.java b/src/main/java/org/olat/shibboleth/ShibbolethDispatcher.java
index ae5069cd16090134f567cf2bd1573f031d13c4f6..124f8ffdcede9fe5736395244820e903e79a08ea 100644
--- a/src/main/java/org/olat/shibboleth/ShibbolethDispatcher.java
+++ b/src/main/java/org/olat/shibboleth/ShibbolethDispatcher.java
@@ -230,15 +230,19 @@ public class ShibbolethDispatcher implements Dispatcher{
 		if(attributesMap.keySet().size()==1) {
 			return false;
 		}
-		String lastname = attributesMap.get(ShibbolethModule.getLastName());
-		String firstname = attributesMap.get(ShibbolethModule.getFirstName());
-		String email = ShibbolethHelper.getFirstValueOf(ShibbolethModule.getEMail(), attributesMap);
-		String institutionalEMail = ShibbolethHelper.getFirstValueOf(ShibbolethModule.getInstitutionalEMail(), attributesMap);
-		String institutionalName = attributesMap.get(ShibbolethModule.getInstitutionalName());
-		//String institutionalUserIdentifier = userMapping.getInstitutionalUserIdentifier();
-		if(lastname!=null && !lastname.equals("") && firstname!=null && !firstname.equals("") && email!=null && !email.equals("") &&
-				institutionalEMail!=null && !institutionalEMail.equals("") && institutionalName!=null && !institutionalName.equals("")) {
-			return true;
+		try {
+			String lastname = attributesMap.get(ShibbolethModule.getLastName());
+			String firstname = attributesMap.get(ShibbolethModule.getFirstName());
+			String email = ShibbolethHelper.getFirstValueOf(ShibbolethModule.getEMail(), attributesMap);
+			String institutionalEMail = ShibbolethHelper.getFirstValueOf(ShibbolethModule.getInstitutionalEMail(), attributesMap);
+			String institutionalName = attributesMap.get(ShibbolethModule.getInstitutionalName());
+			//String institutionalUserIdentifier = userMapping.getInstitutionalUserIdentifier();
+			if(lastname!=null && !lastname.equals("") && firstname!=null && !firstname.equals("") && email!=null && !email.equals("") &&
+					institutionalEMail!=null && !institutionalEMail.equals("") && institutionalName!=null && !institutionalName.equals("")) {
+				return true;
+			}
+		} catch (IllegalArgumentException e) {
+			log.error("Error when reading Shib attributes. Either home org not allowed to connect to this OO instance or user has missing attributes.");
 		}
 		return false;
 	}
diff --git a/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java b/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb76c4735acf487a115ea49a4654de9969e64f5d
--- /dev/null
+++ b/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java
@@ -0,0 +1,43 @@
+/**
+ * <a href="http://www.openolat.org">
+ * OpenOLAT - Online Learning and Training</a><br>
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); <br>
+ * you may not use this file except in compliance with the License.<br>
+ * You may obtain a copy of the License at the
+ * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
+ * <p>
+ * Unless required by applicable law or agreed to in writing,<br>
+ * software distributed under the License is distributed on an "AS IS" BASIS, <br>
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
+ * See the License for the specific language governing permissions and <br>
+ * limitations under the License.
+ * <p>
+ * Initial code contributed and copyrighted by<br>
+ * frentix GmbH, http://www.frentix.com
+ * <p>
+ */
+package org.olat.core.gui.control.generic.iframe;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * 
+ * Initial date: 03.02.2014<br>
+ * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
+ *
+ */
+public class IFrameDeliveryMapperTest {
+	
+	@Test
+	public void testPatternRegex() {
+		IFrameDeliveryMapper mapper = new IFrameDeliveryMapper();
+		String encoding1 = mapper.guessEncoding("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
+		Assert.assertEquals("utf-8", encoding1);
+		
+		String encoding2 = mapper.guessEncoding("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
+		Assert.assertEquals("UTF-8", encoding2);
+	}
+}
diff --git a/src/test/java/org/olat/test/AllTestsJunit4.java b/src/test/java/org/olat/test/AllTestsJunit4.java
index d671a169be784879ddc598a56e23ff195b6d212e..a065724646e8dcf77178fb401cf7be3009cb9df0 100644
--- a/src/test/java/org/olat/test/AllTestsJunit4.java
+++ b/src/test/java/org/olat/test/AllTestsJunit4.java
@@ -66,6 +66,7 @@ import org.junit.runners.Suite;
 	org.olat.core.id.context.HistoryManagerTest.class,
 	org.olat.core.id.IdentityEnvironmentTest.class,
 	org.olat.core.gui.render.VelocityTemplateTest.class,
+	org.olat.core.gui.control.generic.iframe.IFrameDeliveryMapperTest.class,
 	org.olat.note.NoteTest.class,//ok
 	org.olat.user.UserPropertiesPerformanceTest.class,//ok
 	org.olat.user.EmailCheckPerformanceTest.class,//fail