changeset 1937:544a26bdc6d0

Rewrote cookie support for the plugin so that cookies are aquired dynamically from Mozilla for each http/https connection.
author Deepak Bhole <dbhole@redhat.com>
date Thu, 09 Jul 2009 14:42:44 -0400
parents 559f19ce8d7b
children 9af9639e360e
files ChangeLog IcedTeaPlugin.cc netx/net/sourceforge/jnlp/ExtensionDesc.java netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/Launcher.java netx/net/sourceforge/jnlp/NetxPanel.java netx/net/sourceforge/jnlp/Parser.java netx/net/sourceforge/jnlp/PluginBridge.java netx/net/sourceforge/jnlp/cache/CacheUtil.java netx/net/sourceforge/jnlp/cache/Resource.java netx/net/sourceforge/jnlp/cache/ResourceTracker.java netx/net/sourceforge/jnlp/runtime/Boot.java netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java plugin/icedtea/sun/applet/PluginAppletViewer.java plugin/icedtea/sun/applet/PluginCallRequestFactory.java plugin/icedtea/sun/applet/PluginMain.java
diffstat 16 files changed, 126 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 07 13:44:35 2009 -0400
+++ b/ChangeLog	Thu Jul 09 14:42:44 2009 -0400
@@ -1,3 +1,19 @@
+2009-07-09  Deepak Bhole  <dbhole@redhat.com>
+
+	* IcedTeaPlugin.cc: Add suppport for cookie info requests from applets.
+	* plugin/icedtea/sun/applet/PluginAppletViewer.java: Rework cookie support
+	to make it dynamic.
+	* plugin/icedtea/sun/applet/PluginMain.java: Wire in custom cookie store
+	that dynamically requests cookie information from C++ side.
+	* netx/net/sourceforge/jnlp/JNLPFile.java: Remove old cookie handling code.
+	* netx/net/sourceforge/jnlp/Launcher.java: Same.
+	* netx/net/sourceforge/jnlp/NetxPanel.java: Same.
+	* netx/net/sourceforge/jnlp/PluginBridge.java: Same.
+	* netx/net/sourceforge/jnlp/cache/CacheUtil.java: Same.
+	* netx/net/sourceforge/jnlp/cache/Resource.java: Same.
+	* netx/net/sourceforge/jnlp/cache/ResourceTracker.java: Same.
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Same.
+
 2009-07-07  Omair Majid  <omajid@redhat.com>
 
 	* netx/net/sourceforge/jnlp/Parser.java
--- a/IcedTeaPlugin.cc	Tue Jul 07 13:44:35 2009 -0400
+++ b/IcedTeaPlugin.cc	Thu Jul 09 14:42:44 2009 -0400
@@ -1012,6 +1012,7 @@
   void ProcessMessage();
   void ConsumeMsgFromJVM();
   nsresult GetProxyInfo(const char* siteAddr, char** proxyScheme, char** proxyHost, char** proxyPort);
+  nsresult GetCookieInfo(const char* siteAddr, char** cookieString);
   nsCOMPtr<IcedTeaEventSink> sink;
   nsCOMPtr<nsISocketTransport> transport;
   nsCOMPtr<nsIProcess> applet_viewer_process;
@@ -1070,7 +1071,6 @@
   IcedTeaPluginFactory* factory;
   PRUint32 instance_identifier;
   nsCString instanceIdentifierPrefix;
-  nsresult GetCookie(const char* siteAddr, char** cookieString);
 };
 
 
@@ -2380,16 +2380,6 @@
 	  encodedAppletTag += tagMessage.get()[i];
   }
 
-  nsCString cookieInfo(instanceIdentifierPrefix);
-  cookieInfo += "cookie ";
-
-  char* cookieString;
-  if (GetCookie(documentbase, &cookieString) == NS_OK)
-  {
-	  cookieInfo += cookieString;
-  }
-
-  factory->SendMessageToAppletViewer (cookieInfo);
   factory->SendMessageToAppletViewer (encodedAppletTag);
 
   // Set back-pointer to peer instance.
@@ -2760,8 +2750,15 @@
   return NS_OK;
 }
 
+/** 
+ * Returns the cookie information for the given url
+ *
+ * @param siteAddr The URI to check (must be decoded)
+ * @return cookieString The cookie string for the given URI
+ */
+
 NS_IMETHODIMP
-IcedTeaPluginInstance::GetCookie(const char* siteAddr, char** cookieString) 
+IcedTeaPluginFactory::GetCookieInfo(const char* siteAddr, char** cookieString) 
 {
 
   nsresult rv;
@@ -3498,6 +3495,35 @@
 		  // free allocated memory
           delete proxyScheme, proxyHost, proxyPort;
 
+		} else if (command == "PluginCookieInfo") 
+        {
+
+          nsresult rv;
+          nsCOMPtr<nsINetUtil> net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv);
+
+          if (!net_util)
+            printf("Error instantiating NetUtil service.\n");
+
+          // decode the url
+          nsDependentCSubstring url;
+          net_util->UnescapeString(rest, 0, url);
+
+          nsCString cookieInfo("plugin PluginCookieInfo ");
+          cookieInfo += rest;
+          cookieInfo += " ";
+
+          char* cookieString;
+          if (GetCookieInfo(((nsCString) url).get(), &cookieString) == NS_OK)
+          {
+              cookieInfo += cookieString;
+              PLUGIN_DEBUG_2ARG("Cookie for %s is %s\n", ((nsCString) url).get(), cookieString);
+          } else {
+              PLUGIN_DEBUG_1ARG("No cookie found for %s\n", ((nsCString) url).get());
+          }
+
+          // send back what we found
+          SendMessageToAppletViewer (cookieInfo);
+
 		}
 	}
 }
--- a/netx/net/sourceforge/jnlp/ExtensionDesc.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/ExtensionDesc.java	Thu Jul 09 14:42:44 2009 -0400
@@ -40,9 +40,6 @@
 
     /** the location of the extension JNLP file */
     private URL location;
-    
-    /** the cookie string sent with resource requests */
-    private String cookieStr;
 
     /** the JNLPFile the extension refers to */
     private JNLPFile file;
@@ -61,11 +58,10 @@
      * @param version the required version of the extention JNLPFile
      * @param location the location of the extention JNLP file
      */
-    public ExtensionDesc(String name, Version version, URL location, String cookieStr) {
+    public ExtensionDesc(String name, Version version, URL location) {
         this.name = name;
         this.version = version;
         this.location = location;
-        this.cookieStr = cookieStr;
     }
 
     /**
@@ -125,7 +121,7 @@
      */
     public void resolve() throws ParseException, IOException {
         if (file == null) {
-            file = new JNLPFile(location, cookieStr);
+            file = new JNLPFile(location);
 
             if (JNLPRuntime.isDebug())
                 System.out.println("Resolve: "+file.getInformation().getTitle());
@@ -144,14 +140,6 @@
     public JNLPFile getJNLPFile() {
         return file;
     }
-    
-    /**
-     * Returns the cookie associated with this instance
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
-
 }
 
 
--- a/netx/net/sourceforge/jnlp/JNLPFile.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java	Thu Jul 09 14:42:44 2009 -0400
@@ -69,9 +69,6 @@
 
     /** the URL used to resolve relative URLs in the file */
     protected URL codeBase;
-    
-    /** cookie string to send alongwith resource requests */
-    protected String cookieStr;
 
     /** file version */
     protected Version fileVersion;
@@ -127,8 +124,8 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, String cookieStr) throws IOException, ParseException {
-        this(location, cookieStr, false); // not strict
+    public JNLPFile(URL location) throws IOException, ParseException {
+        this(location, false); // not strict
     }
 
     /**
@@ -140,8 +137,8 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, String cookieStr, boolean strict) throws IOException, ParseException {
-        this(location, cookieStr, strict, JNLPRuntime.getDefaultUpdatePolicy());
+    public JNLPFile(URL location, boolean strict) throws IOException, ParseException {
+        this(location, strict, JNLPRuntime.getDefaultUpdatePolicy());
     }
 
     /**
@@ -154,12 +151,11 @@
      * @throws IOException if an IO exception occurred
      * @throws ParseException if the JNLP file was invalid
      */
-    public JNLPFile(URL location, String cookieStr, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        Node root = Parser.getRootNode(openURL(location, cookieStr, policy));
+    public JNLPFile(URL location, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
+        Node root = Parser.getRootNode(openURL(location, policy));
         parse(root, strict, location);
 
         this.fileLocation = location;
-        this.cookieStr = cookieStr;
     }
 
     /**
@@ -190,13 +186,13 @@
      * Open the jnlp file URL from the cache if there, otherwise
      * download to the cache.  Called from constructor.
      */
-    private static InputStream openURL(URL location, String cookieStr, UpdatePolicy policy) throws IOException {
+    private static InputStream openURL(URL location, UpdatePolicy policy) throws IOException {
         if (location == null || policy == null)
             throw new IllegalArgumentException(R("NullParameter"));
 
         try {
             ResourceTracker tracker = new ResourceTracker(false); // no prefetch
-            tracker.addResource(location, cookieStr, null/*version*/, policy);
+            tracker.addResource(location, null/*version*/, policy);
 
             return tracker.getInputStream(location);
         }
@@ -256,13 +252,6 @@
     public URL getCodeBase() {
         return codeBase;
     }
-
-    /**
-     * Returns the cookie string that will be send when resources for this file are requested 
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
     
     /**
      * Returns the information section of the JNLP file as viewed
--- a/netx/net/sourceforge/jnlp/Launcher.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/Launcher.java	Thu Jul 09 14:42:44 2009 -0400
@@ -335,10 +335,10 @@
             JNLPFile file = null;
 
             try {
-                file = new JNLPFile(location, null, true, updatePolicy); // strict
+                file = new JNLPFile(location, true, updatePolicy); // strict
             }
             catch (ParseException ex) {
-                file = new JNLPFile(location, null, false, updatePolicy);
+                file = new JNLPFile(location, false, updatePolicy);
 
                 // only here if strict failed but lax did not fail 
                 LaunchException lex = 
@@ -389,7 +389,7 @@
                     IconDesc.SPLASH, preferredWidth, preferredHeight);
             if (splashImageURL != null) {
                 ResourceTracker resourceTracker = new ResourceTracker(true);
-                resourceTracker.addResource(splashImageURL, "SPLASH", file.getFileVersion(), updatePolicy);
+                resourceTracker.addResource(splashImageURL, file.getFileVersion(), updatePolicy);
                 splashScreen = new JNLPSplashScreen(resourceTracker, null, null);
                 splashScreen.setSplashImageURL(splashImageURL);
                 if (splashScreen.isSplashScreenValid()) {
--- a/netx/net/sourceforge/jnlp/NetxPanel.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/NetxPanel.java	Thu Jul 09 14:42:44 2009 -0400
@@ -41,7 +41,6 @@
     private PluginBridge bridge = null;
     private boolean exitOnFailure = true;
     private AppletInstance appInst = null;
-    private String cookieStr;
     private boolean appletAlive;
 
     public NetxPanel(URL documentURL, Hashtable atts)
@@ -50,11 +49,10 @@
     }
     
     // overloaded constructor, called when initialized via plugin 
-    public NetxPanel(URL documentURL, String cookieStr, Hashtable atts, boolean exitOnFailure)
+    public NetxPanel(URL documentURL, Hashtable atts, boolean exitOnFailure)
     {
         this(documentURL, atts);
         this.exitOnFailure = exitOnFailure;
-        this.cookieStr = cookieStr;
         this.appletAlive = true;
     }
 
@@ -64,7 +62,6 @@
 
     	try {
     		bridge = new PluginBridge(baseURL,
-    				cookieStr,
     				getDocumentBase(),
     				getJarFiles(), 
     				getCode(),
--- a/netx/net/sourceforge/jnlp/Parser.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/Parser.java	Thu Jul 09 14:42:44 2009 -0400
@@ -332,7 +332,7 @@
         Version version = getVersion(node, "version", null);
         URL location = getRequiredURL(node, "href", base);
 
-        ExtensionDesc ext = new ExtensionDesc(name, version, location, null);
+        ExtensionDesc ext = new ExtensionDesc(name, version, location);
 
         Node dload[] = getChildNodes(node, "ext-download");
         for (int i=0; i < dload.length; i++) {
--- a/netx/net/sourceforge/jnlp/PluginBridge.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java	Thu Jul 09 14:42:44 2009 -0400
@@ -43,7 +43,7 @@
     String[] cache_ex_jars = new String[0];
     Hashtable atts;
 
-    public PluginBridge(URL codebase, String cookieStr, URL documentBase, String jar, String main,
+    public PluginBridge(URL codebase, URL documentBase, String jar, String main,
                         int width, int height, Hashtable atts)
     throws Exception
     {
@@ -104,7 +104,6 @@
         else
             security = null;
         
-        this.cookieStr = cookieStr;
     }
 
     public String getTitle()
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java	Thu Jul 09 14:42:44 2009 -0400
@@ -75,9 +75,9 @@
      * @param version the version, or null
      * @return either the location in the cache or the original location
      */
-    public static URL getCachedResource(URL location, String cookieStr, Version version, UpdatePolicy policy) {
+    public static URL getCachedResource(URL location, Version version, UpdatePolicy policy) {
         ResourceTracker rt = new ResourceTracker();
-        rt.addResource(location, cookieStr, version, policy);
+        rt.addResource(location, version, policy);
         try {
             File f = rt.getCacheFile(location);
             return f.toURL();
--- a/netx/net/sourceforge/jnlp/cache/Resource.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/cache/Resource.java	Thu Jul 09 14:42:44 2009 -0400
@@ -68,9 +68,6 @@
     /** the remote location of the resource */
     URL location;
     
-    /** cookie string to send with the resource request */
-    String cookieStr;
-
     /** the local file downloaded to */
     File localFile;
 
@@ -98,20 +95,19 @@
     /**
      * Create a resource.
      */
-    private Resource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
+    private Resource(URL location, UpdatePolicy updatePolicy, Version requestVersion) {
         this.location = location;
         this.requestVersion = requestVersion;
         this.updatePolicy = updatePolicy;
-        this.cookieStr = cookieStr;
     }
 
     /**
      * Return a shared Resource object representing the given
      * location and version.
      */
-    public static Resource getResource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
+    public static Resource getResource(URL location, UpdatePolicy updatePolicy, Version requestVersion) {
         synchronized (resources) {
-            Resource resource = new Resource(location, cookieStr, updatePolicy, requestVersion);
+            Resource resource = new Resource(location, updatePolicy, requestVersion);
 
             int index = resources.indexOf(resource);
             if (index >= 0) { // return existing object
@@ -133,13 +129,6 @@
     public URL getLocation() {
         return location;
     }
-    
-    /**
-     * Returns the cookie string associated with this resource
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
 
     /**
      * Returns the tracker that first created or monitored the
--- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java	Thu Jul 09 14:42:44 2009 -0400
@@ -148,11 +148,11 @@
      * @param version the resource version
      * @param updatePolicy whether to check for updates if already in cache
      */
-    public void addResource(URL location, String cookieStr, Version version, UpdatePolicy updatePolicy) {
+    public void addResource(URL location, Version version, UpdatePolicy updatePolicy) {
         if (location == null)
             throw new IllegalArgumentException("location==null");
 
-        Resource resource = Resource.getResource(location, cookieStr, updatePolicy, version);
+        Resource resource = Resource.getResource(location, updatePolicy, version);
         boolean downloaded = false;
 
         synchronized (resources) {
@@ -606,9 +606,6 @@
         try {
             // create out second in case in does not exist
             URLConnection con = getVersionedResourceURL(resource).openConnection();
-            
-            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
-                con.setRequestProperty("Cookie", resource.getCookieStr());
 
             InputStream in = new BufferedInputStream(con.getInputStream());
             OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion);
@@ -657,9 +654,6 @@
 
             // connect
             URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized
-            
-            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
-                connection.setRequestProperty("Cookie", resource.getCookieStr());
 
             int size = connection.getContentLength();
             boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE;
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java	Thu Jul 09 14:42:44 2009 -0400
@@ -276,7 +276,7 @@
         
         boolean strict = (null != getOption("-strict"));
 
-        JNLPFile file = new JNLPFile(url, null, strict);
+        JNLPFile file = new JNLPFile(url, strict);
 
         // add in extra params from command line
         addProperties(file);
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu Jul 09 14:42:44 2009 -0400
@@ -234,11 +234,11 @@
      * @param location the file's location
      * @param policy the update policy to use when downloading resources
      */
-    public static JNLPClassLoader getInstance(URL location, String cookieStr, UpdatePolicy policy) throws IOException, ParseException, LaunchException {
+    public static JNLPClassLoader getInstance(URL location, UpdatePolicy policy) throws IOException, ParseException, LaunchException {
         JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location);
 
         if (loader == null)
-            loader = getInstance(new JNLPFile(location, cookieStr, false, policy), policy);
+            loader = getInstance(new JNLPFile(location, false, policy), policy);
 
         return loader;
     }
@@ -256,7 +256,7 @@
 		//if (ext != null) {
         	for (int i=0; i < ext.length; i++) {
             	try {
-               		JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getCookieStr(), updatePolicy);
+               		JNLPClassLoader loader = getInstance(ext[i].getLocation(), updatePolicy);
                 	loaderList.add(loader);
             	}
             	catch (Exception ex) {
@@ -314,7 +314,6 @@
                 initialJars.add(jars[i]); // regardless of part
 
             tracker.addResource(jars[i].getLocation(),
-                                file.getCookieStr(),
                                 jars[i].getVersion(), 
                                 jars[i].isCacheable() ? JNLPRuntime.getDefaultUpdatePolicy() : UpdatePolicy.FORCE
                                );
@@ -780,8 +779,7 @@
 
                             available.add(desc);
 
-                            tracker.addResource(desc.getLocation(), 
-                                    file.getCookieStr(),
+                            tracker.addResource(desc.getLocation(),
                                     desc.getVersion(), 
                                     JNLPRuntime.getDefaultUpdatePolicy()
                             );
--- a/plugin/icedtea/sun/applet/PluginAppletViewer.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java	Thu Jul 09 14:42:44 2009 -0400
@@ -84,6 +84,7 @@
 import java.io.PrintStream;
 import java.io.Reader;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
 import java.net.SocketPermission;
@@ -180,9 +181,6 @@
      private static PluginStreamHandler streamhandler;
      
      private static PluginCallRequestFactory requestFactory;
-     
-     private static HashMap<Integer, String> siteCookies = 
-         new HashMap<Integer,String>();
 
      private static HashMap<Integer, PAV_INIT_STATUS> status = 
          new HashMap<Integer,PAV_INIT_STATUS>();
@@ -226,7 +224,7 @@
          AccessController.doPrivileged(new PrivilegedAction() {
              public Object run() {
             	 	try {
-            	 		panel = new NetxPanel(doc, siteCookies.get(identifier), atts, false);
+            	 		panel = new NetxPanel(doc, atts, false);
             	 		AppletViewerPanel.debug("Using NetX panel");
             	 		PluginDebug.debug(atts.toString());
             	 	} catch (Exception ex) {
@@ -483,16 +481,6 @@
             			 PluginDebug.debug ("REQUEST TAG NOT SET: " + request.tag + ". BYPASSING");
             		 }
             	 }
-             } else if (message.startsWith("cookie")) {
-                 
-                 int cookieStrIndex = message.indexOf(" ");
-                 String cookieStr = null;
-
-                 if (cookieStrIndex > 0)
-                     cookieStr = message.substring(cookieStrIndex);
-
-                 // Always set the cookie -- even if it is null
-                 siteCookies.put(identifier, cookieStr);
              } else {
                  PluginDebug.debug ("Handling message: " + message + " instance " + identifier + " " + Thread.currentThread());
 
@@ -842,7 +830,6 @@
       * applets on this page.
       */
      public Enumeration getApplets() {
- 	AppletSecurity security = (AppletSecurity)System.getSecurityManager();
  	Vector v = new Vector();
  	SocketPermission panelSp =
  	    new SocketPermission(panel.getCodeBase().getHost(), "connect");
@@ -896,7 +883,7 @@
  	    // streamhandler.pluginOutputStream has been closed.
  	}
      }
- 
+     
      public long getWindow() {
     	 PluginDebug.debug ("STARTING getWindow");
     	 PluginCallRequest request = requestFactory.getPluginCallRequest("window",
@@ -1113,6 +1100,40 @@
          return request.getObject();
      }
  
+     public static Object requestPluginCookieInfo(URI uri) {
+
+         PluginCallRequest request;
+         try
+         {
+             String encodedURI = UrlUtil.encode(uri.toString(), "UTF-8"); 
+             request = requestFactory.getPluginCallRequest("cookieinfo",
+                               "plugin PluginCookieInfo " + encodedURI, 
+                               "plugin PluginCookieInfo " + encodedURI);
+
+         } catch (UnsupportedEncodingException e)
+         {
+             e.printStackTrace();
+             return null;
+         }
+
+         streamhandler.postCallRequest(request);
+         streamhandler.write(request.getMessage());
+         try {
+             PluginDebug.debug ("wait cookieinfo request 1");
+             synchronized(request) {
+                 PluginDebug.debug ("wait cookieinfo request 2");
+                 while (request.isDone() == false)
+                     request.wait();
+                 PluginDebug.debug ("wait cookieinfo request 3");
+             }
+         } catch (InterruptedException e) {
+             throw new RuntimeException("Interrupted waiting for cookieinfo request.",
+                                        e);
+         }
+         PluginDebug.debug (" Cookieinfo DONE");
+         return request.getObject();
+     }
+
      public static Object requestPluginProxyInfo(URI uri) {
 
          String requestURI = null;
@@ -1623,10 +1644,6 @@
      public static void parse(int identifier, long handle, Reader in, URL url)
          throws IOException {
          
-         // wait until cookie is set (even if cookie is null, it needs to be 
-         // "set" to that first
-         while (!siteCookies.containsKey(identifier));
-
     	 final int fIdentifier = identifier;
     	 final long fHandle = handle;
     	 final Reader fIn = in;
--- a/plugin/icedtea/sun/applet/PluginCallRequestFactory.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginCallRequestFactory.java	Thu Jul 09 14:42:44 2009 -0400
@@ -51,6 +51,8 @@
 			return new GetWindowPluginCallRequest(message, returnString);
 		} else if (id == "proxyinfo") {
             return new PluginProxyInfoRequest(message, returnString);
+        }  else if (id == "cookieinfo") {
+            return new PluginCookieInfoRequest(message, returnString);
         } else {
 			throw new RuntimeException ("Unknown plugin call request type requested from factory");
 		}
--- a/plugin/icedtea/sun/applet/PluginMain.java	Tue Jul 07 13:44:35 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginMain.java	Thu Jul 09 14:42:44 2009 -0400
@@ -68,10 +68,11 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.net.Authenticator;
+import java.net.CookieHandler;
+import java.net.CookieManager;
 import java.net.PasswordAuthentication;
 import java.net.ProxySelector;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Properties;
 
 import javax.net.ssl.HttpsURLConnection;
@@ -218,6 +219,9 @@
 		// plug in a custom authenticator and proxy selector
         Authenticator.setDefault(new CustomAuthenticator());
         ProxySelector.setDefault(new PluginProxySelector());
+        
+        CookieManager ckManager = new CookieManager(new PluginCookieStore(), null);
+        CookieHandler.setDefault(ckManager);
 	}
 
     static boolean messageAvailable() {