[RFC][icedtea-web] Fix for PR855: AppletStub getDocumentBase() doesn't return full URL

Deepak Bhole dbhole at redhat.com
Mon Apr 16 10:18:16 PDT 2012


* Danesh Dadachanji <ddadacha at redhat.com> [2012-02-03 15:40]:
> Hi,
> 
> This patch is a fix for PR855[1]. The return of getDocumentBase()
> currently doesn't include the HTML file. According to the docs, it
> should return the entire path of the HTML, including the filename.
> 
> Attached is a patch that adds this. I've checked all the traces of
> the bytes grabbed from the pipe over on the java side. I believe I
> covered every read and assignment of the buffer/vars setup from the
> buffer and so on. We fortunately only ever used getDocumentBase()'s
> return to grab the host IP or use it as a base URL. The latter code
> grabbed the return and cut off everything after the last '/', which
> back before patch is the entire URL, post patch is the URL excluding
> the file name.
> 
> Okay for HEAD? Thoughts on backporting to release branches? It was
> reported against 1.1.3 but this is a pretty big change that
> potentially affects the way users' applications behave.
> 

Looking at the surrounding code, we are taking a URL, splitting it on
"/" and then combining the first length-1 components. This was done to
purposely remove the file name itself.

However if we want to add the file name back, we should just remove all
of the splitting/combing code rather than appending the last part.

Have you tried using NPVARIANT_TO_STRING(href).utf8characters directly?

Cheers,
Deepak

> +2012-02-03  Danesh Dadachanji  <ddadacha at redhat.com>
> +
> +	PR855: AppletStub getDocumentBase() doesn't return full URL
> +	* plugin/icedteanp/IcedTeaNPPlugin.cc (plugin_get_documentbase): Fixed
> +	location string storing the document base to include the HTML file.
> +
> 
> Regards,
> Danesh
> 
> [1] http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=855

> diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
> --- a/plugin/icedteanp/IcedTeaNPPlugin.cc
> +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
> @@ -1094,6 +1094,7 @@ plugin_get_documentbase (NPP instance)
>        location_str += "/";
>    }
>  
> +  location_str += parts[parts_sz - 1]; // Need to add the html file name.
>    documentbase_copy = g_strdup (location_str.c_str());
>  
>    // Release references.




More information about the distro-pkg-dev mailing list