--- //nutch/2.2.1/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.java	2013-07-09 20:47:42.000000000 -0400
+++ //nutch/2.2.1/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.java	2013-07-15 13:32:37.000000000 -0400
@@ -36,6 +36,8 @@
   public static final Logger LOG = LoggerFactory.getLogger(Http.class);
 
   private static final Collection<WebPage.Field> FIELDS = new HashSet<WebPage.Field>();
+  
+  private String cookieString = "";
 
   static {
     FIELDS.add(WebPage.Field.MODIFIED_TIME);
@@ -49,6 +51,9 @@
   @Override
   public void setConf(Configuration conf) {
     super.setConf(conf);
+	
+	this.cookieString = conf.get("http.cookie_string", "").trim();
+	
 //    Level logLevel = Level.WARNING;
 //    if (conf.getBoolean("http.verbose", false)) {
 //      logLevel = Level.FINE;
@@ -65,7 +70,7 @@
   @Override
   protected Response getResponse(URL url, WebPage page, boolean redirect)
     throws ProtocolException, IOException {
-    return new HttpResponse(this, url, page);
+    return new HttpResponse(this, url, page, this.cookieString);
   }
 
   public Collection<WebPage.Field> getFields() {
--- //nutch/2.2.1/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java	2013-07-09 20:47:42.000000000 -0400
+++ //nutch/2.2.1/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java	2013-07-15 13:32:37.000000000 -0400
@@ -48,7 +48,7 @@
   private final Metadata headers = new SpellCheckedMetadata();
 
 
-  public HttpResponse(HttpBase http, URL url, WebPage page)
+  public HttpResponse(HttpBase http, URL url, WebPage page, String cookieString)
   throws ProtocolException, IOException {
 
     this.http = http;
@@ -121,6 +121,12 @@
         reqStr.append(userAgent);
         reqStr.append("\r\n");
       }
+	  
+	  if (!cookieString.isEmpty()){
+	     reqStr.append("Cookie: ");
+		 reqStr.append(cookieString);
+         reqStr.append("\r\n");
+      }  	  
 
       if (page.isReadable(WebPage.Field.MODIFIED_TIME.getIndex())) {
         reqStr.append("If-Modified-Since: " +
--- //nutch/2.2.1/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.java	2013-07-09 20:47:42.000000000 -0400
+++ //nutch/2.2.1/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.java	2013-07-15 13:32:37.000000000 -0400
@@ -82,6 +82,8 @@
 	private static String agentHost;
 	private static boolean authRulesRead = false;
 	private static Configuration conf;
+	
+	private String cookieString = "";
 
 	int maxThreadsTotal = 10;
 
@@ -133,6 +135,8 @@
 		this.proxyRealm = conf.get("http.proxy.realm", "");
 		agentHost = conf.get("http.agent.host", "");
 		authFile = conf.get("http.auth.file", "");
+		this.cookieString = conf.get("http.cookie_string", "").trim();
+		
 		configureClient();
 		try {
 			setCredentials();
@@ -190,6 +194,9 @@
 		params.setSendBufferSize(BUFFER_SIZE);
 		params.setReceiveBufferSize(BUFFER_SIZE);
 		params.setMaxTotalConnections(maxThreadsTotal);
+		//Also set max connections per host to maxThreadsTotal since all threads
+		//might be used to fetch from the same host - otherwise timeout errors can occur
+		params.setDefaultMaxConnectionsPerHost(maxThreadsTotal);
 
 		// executeMethod(HttpMethod) seems to ignore the connection timeout on
 		// the connection manager.
@@ -212,6 +219,11 @@
 				"text/html,application/xml;q=0.9,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"));
 		// accept gzipped content
 		headers.add(new Header("Accept-Encoding", "x-gzip, gzip, deflate"));
+		
+		if (!cookieString.isEmpty()){
+		    headers.add(new Header("Cookie", cookieString));
+		}
+		
 		hostConf.getParams().setParameter("http.default-headers", headers);
 
 		// HTTP proxy server details
