Opened 11 years ago

Closed 10 years ago

#5732 closed defect (fixed)

baseUrl not computed when url has a parameter

Reported by: guest Owned by: James Burke
Priority: high Milestone: 1.3
Component: Core Version: 1.0
Keywords: Cc: ctheiss@…
Blocked By: Blocking:

Description

When using a server framework it is often the case that url rewriting becomes an issue. For example, if you don't know your application context and are using JSP, you might want to wrap your dojo call in a c:url:

<script type='text/javascript' src='<c:url value="/javascript/dojo/dojo.js"/>'></script>

However, if cookies are turned off, a session identified might be appended to the url:

<script type='text/javascript' src='/myapp/javascript/dojo/dojo.js;jsessionid=23482357984578578542875'></script>

This added parameter breaks the regex in hostenv_browser.js so that baseUrl is not computed:

  var rePkg = /dojo(.xd)?.js([?.]|$)/i;

The regex should probably be changed to (notice the extra semi-colon):

  var rePkg = /dojo(.xd)?.js([;?.]|$)/i;

to handle this case.

Change History (9)

comment:1 Changed 11 years ago by Adam Peller

Milestone: 1.0.3
Owner: changed from anonymous to James Burke

is this a valid url syntax?

comment:2 Changed 11 years ago by guest

It is valid syntax: it is a path parameter rather than a query parameter. See the last paragraph of 3.3: http://www.rfc.net/rfc3986.html#p22

comment:3 Changed 11 years ago by guest

Please add me as cc: ctheiss@…

Thanks!

comment:4 Changed 11 years ago by James Burke

Cc: ctheiss@… added
Milestone: 1.1

I'll see about getting this in for 1.1. Note that you can always force the baseUrl via djConfig.baseUrl, so that is a workaround.

comment:5 Changed 11 years ago by guest

Setting djConfig.baseUrl, while an acceptable workaround, has two issues which prevent it from being a "good" fix:

  1. You can hard-code it, but now your application is no longer context-agnostic
  2. You can run a regular expression against window.location.href, but it would be almost exactly the same code as in hostenv_browser.js (except with the extra semi-colon).

comment:6 Changed 11 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [12272]) Fixes #5732. Allow other non-word character terminators like ; for dojo url.

comment:7 Changed 11 years ago by Christian Schröder

Resolution: fixed
Status: closedreopened

The fixed RegularExpression? from the changeset:122272 should also be used in the dojo.js because there is also code which tries to figure out the baseUrl.

comment:8 Changed 11 years ago by bill

Milestone: 1.11.3

since these tickets were reopened, marking milestone as 1.3 (the next uncompleted milestone) so we don't overlook them

comment:9 Changed 10 years ago by James Burke

Resolution: fixed
Status: reopenedclosed

(In [16080]) Fixes #5732, allow dojo.js urls to end in a semicolon. Using the same match as used in hostenv_browser.js. \!strict

Note: See TracTickets for help on using tickets.