spaces in urls; problem with URL rewriting

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

spaces in urls; problem with URL rewriting

Jan Willem Knopper
Hi,

I seem to be encountering some problems with spaces in URLs and I wonder
if it is just me. It looks like the URL is decoded twice.

In our setup we have files on the file system, which we load with the
URL generator (and then process). Usually they do not contain spaces,
and they are easily renamed, but I wondered if I was doing something
wrong, or if this is something that might effect more people.

The details are:

- I am using Orbeon 3.7.1.
- files are loaded using the page-flow.xml file with a page-tag with
  model/view attributes
- the instance given to the model contains a resource which is decoded.
- to load the file (I use the url-generator processor), I could do some
  work-around to re-encode of the URL; something like
  replace(replace(encode-for-uri($url),"%2F","/","i"),"%3A",":","i")
  However, I'm not happy with this.

But it goes wrong in the HTML page, where the main orbeon form is
created with an invalid action (namely the decoded resource).

This form is generated in XHTMLBodyHandler:
orbeon/src/java/org/orbeon/oxf/xforms/processor/handlers/XHTMLBodyHandler.java

Which sets the submissionpath (in this case defaulting to the local
document) to:
handlerContext.getExternalContext().getRequest().getRequestPath()

This then leads to an exception in the rewriteURL function, when the URL
gets rewritten later.

This can be tested by creating a file with the name file%20.xml and
viewing it with file%2520.xml
The resource will contain file%20.xml, and the orbeon outer form
element: <form id="xforms-form" ...> will contain an action attribute
"/.../file%20.xml". The URL for the current page however, is
"/.../file%2520.xml"

I would be interested to know if I am the only one with this problem
and/or if there is an easy fix.

Thanks in advance,

Jan Willem Knopper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: spaces in urls; problem with URL rewriting

Alessandro  Vernet
Administrator
Jan,

I am not sure how to reproduce this. Could submit an "app" (zip that I
can uncompress in the apps directory) with steps to reproduce this?

Alex

On Wed, Mar 24, 2010 at 3:13 AM, Jan Willem Knopper <[hidden email]> wrote:

> Hi,
>
> I seem to be encountering some problems with spaces in URLs and I wonder
> if it is just me. It looks like the URL is decoded twice.
>
> In our setup we have files on the file system, which we load with the
> URL generator (and then process). Usually they do not contain spaces,
> and they are easily renamed, but I wondered if I was doing something
> wrong, or if this is something that might effect more people.
>
> The details are:
>
> - I am using Orbeon 3.7.1.
> - files are loaded using the page-flow.xml file with a page-tag with
>  model/view attributes
> - the instance given to the model contains a resource which is decoded.
> - to load the file (I use the url-generator processor), I could do some
>  work-around to re-encode of the URL; something like
>  replace(replace(encode-for-uri($url),"%2F","/","i"),"%3A",":","i")
>  However, I'm not happy with this.
>
> But it goes wrong in the HTML page, where the main orbeon form is
> created with an invalid action (namely the decoded resource).
>
> This form is generated in XHTMLBodyHandler:
> orbeon/src/java/org/orbeon/oxf/xforms/processor/handlers/XHTMLBodyHandler.java
>
> Which sets the submissionpath (in this case defaulting to the local
> document) to:
> handlerContext.getExternalContext().getRequest().getRequestPath()
>
> This then leads to an exception in the rewriteURL function, when the URL
> gets rewritten later.
>
> This can be tested by creating a file with the name file%20.xml and
> viewing it with file%2520.xml
> The resource will contain file%20.xml, and the orbeon outer form
> element: <form id="xforms-form" ...> will contain an action attribute
> "/.../file%20.xml". The URL for the current page however, is
> "/.../file%2520.xml"
>
> I would be interested to know if I am the only one with this problem
> and/or if there is an easy fix.
>
> Thanks in advance,
>
> Jan Willem Knopper
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: spaces in urls; problem with URL rewriting

Jan Willem Knopper
Alessandro Vernet wrote:
> Jan,
>
> I am not sure how to reproduce this. Could submit an "app" (zip that I
> can uncompress in the apps directory) with steps to reproduce this?
>
Thanks for your quick testing and reply. It was a good suggestion to
create a minimal "app". The problem occurs in the epilogue if the
following model is present in the <head> (and the filename contains a
space).

It goes wrong with an XHTML file with the following model in the header:
(In our application models are added automatically if they don't exist,
so that is why there is a model, even if there are no form elements)

    <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml">
       <xforms:instance id="default-instance">
         <wrapper xmlns="">
           <media/>
           <resource>/mathdox/file .xhtml</resource>
           <temporary>
             <collectionbase xmlns:xu="http://www.xmldb.org/xupdate">file:/var/lib/tomcat6/webapps/orbeon/WEB-INF/resources/apps/mathdox//mathdox</collectionbase>
             <parent/>
             <child/>
           </temporary>
         </wrapper>
       </xforms:instance>
       <xforms:submission method="post" action="/mathdox/file .xhtml" id="submission"/>
     </xforms:model>

I will send you a zip of the minimal app with some comments in private
mail, so it will not go to the list.

Thanks again,

Jan Willem


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: spaces in urls; problem with URL rewriting

Jan Willem Knopper
Alessandro Vernet wrote:

> Hi Jan,
>
> I read some of your code, but don't have the time to go through all
> the files. It looks to me like you are doing something like the
> following which I was able to run something like:
>
>     <p:processor name='oxf:url-generator'>
>       <p:input name='config'>
>           <config>
>               <url>file:/path/to/mathdox/file%20.xhtml</url>
>               <content-type>application/xml</content-type>
>           </config>
>      </p:input>
>       <p:output name='data' ref='data'/>
>     </p:processor>
>
This is indeed what I am doing, and loading the file is not a problem.
The problem seems to come from accessing the URL
  /orbeon/mathdox/file%20.xhtml

Some other URLs that might be interesting are:
  /orbeon/mathdox/file.xhtml
  /orbeon/mathdox/file%2520.xhtml (%25 becomes %)
>
> Could you:
>
> 1. Send an updated app which is simpler, in the sense that it just
> contains the code that you want to show (if possible a single page
> flow and pipeline).
is attached as mathdox.zip, containing a page-flow, a simple model with
just the url generator and an identity view.

> 2. Make sure there are no hard coded paths, or please indicate in your
> message what I should change.
The hardcoded path is in the model: mathdox/storage/load-short.xpl

> 3. Post it on the mailing list.

this post is to the mailing list.

Thanks again,

Jan Willem


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

mathdox.zip (3K) Download Attachment
attachment1 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: spaces in urls; problem with URL rewriting

Alessandro  Vernet
Administrator
Jan,

Thanks! I got to reproduce it. It is "just" an issue in the rewriter
when there is space in the URL. You can in fact reproduce this by
going to http://localhost:8080/orbeon/xforms-hello/%20 (just adding a
space at the end of the URL). For now, I entered a bug to track this:

http://forge.ow2.org/tracker/index.php?func=detail&aid=314872&group_id=168&atid=350207

Alex


On Mon, Mar 29, 2010 at 9:49 AM, Jan Willem Knopper <[hidden email]> wrote:

> Alessandro Vernet wrote:
>> Hi Jan,
>>
>> I read some of your code, but don't have the time to go through all
>> the files. It looks to me like you are doing something like the
>> following which I was able to run something like:
>>
>>     <p:processor name='oxf:url-generator'>
>>       <p:input name='config'>
>>           <config>
>>               <url>file:/path/to/mathdox/file%20.xhtml</url>
>>               <content-type>application/xml</content-type>
>>           </config>
>>      </p:input>
>>       <p:output name='data' ref='data'/>
>>     </p:processor>
>>
>
> This is indeed what I am doing, and loading the file is not a problem.
> The problem seems to come from accessing the URL
>  /orbeon/mathdox/file%20.xhtml
>
> Some other URLs that might be interesting are:
>  /orbeon/mathdox/file.xhtml
>  /orbeon/mathdox/file%2520.xhtml (%25 becomes %)
>>
>> Could you:
>>
>> 1. Send an updated app which is simpler, in the sense that it just
>> contains the code that you want to show (if possible a single page
>> flow and pipeline).
> is attached as mathdox.zip, containing a page-flow, a simple model with
> just the url generator and an identity view.
>
>> 2. Make sure there are no hard coded paths, or please indicate in your
>> message what I should change.
> The hardcoded path is in the model: mathdox/storage/load-short.xpl
>
>> 3. Post it on the mailing list.
>
> this post is to the mailing list.
>
> Thanks again,
>
> Jan Willem
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet