jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bennett McElwee" <Bennett.McEl...@telecom.co.nz>
Subject RE: &amp; in dynamic links
Date Mon, 19 Jun 2006 22:05:26 GMT
>>  <a href="http://www.example.com/go?s=1&t=2">Go</a>
> Are you sure it's not valid?

Quite sure. Any ampersand appearing in a text node or an attribute is
interpreted as the beginning of an entity reference (e.g. &quot;).
Therefore if you want an ampersand in text or in an attribute (such as
an href), you must encode it as &amp; (or the equivalent Unicode code).

But don't take my word for it. Try http://validator.w3.org/

This HTML, with an unencoded ampersand:

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
   <html>
   <head><title>Test</title></head>
   <body><a href="http://www.example.com/go?s=1&t=2">Go</a></body>
   </html>

gives this result when fed to the validator:

   This page is not Valid HTML 4.01 Transitional!
   1. Warning Line 5 column 45: cannot generate system identifier for
general entity "t".
   2. Error Line 5 column 45: general entity "t" not defined and no
default entity.
   3. Error Line 5 column 46: reference to entity "t" for which no
system identifier could be generated.

But if you encode the ampersand:

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
   <html>
   <head><title>Test</title></head>
   <body><a href="http://www.example.com/go?s=1&amp;t=2">Go</a></body>
   </html>

you get the gold seal of approval:

   This Page Is Valid HTML 4.01 Transitional!


Many web browsers will silently "fix" unencoded ampersands, and because
of this, probably a few web applications and web sites do contain
unencoded ampersands. So a good tool should probably assume encoding,
but be able to handle the unencoded case.

Cheerio,
Bennett.
--
Bennett McElwee

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Monday, 19 June 2006 8:50 pm
To: JMeter Users List
Subject: Re: &amp; in dynamic links

On 18/06/06, Bennett McElwee <Bennett.McElwee@telecom.co.nz> wrote:
> Well, anything appearing in an HTML file should be decoded before
being
> used. This:
>
>   <a href="http://www.example.com/go?s=1&amp;t=2">Go</a>
>
> Refers to the URL http://www.example.com/go?s=1&t=2
>
> Whereas this:
>
>   <a href="http://www.example.com/go?s=1&t=2">Go</a>
>

Are you sure it's not valid?

> is not even valid HTML.
>
> Sadly, of course, plenty of web apps generate invalid HTML. Maybe
JMeter
> needs to cater for these. But it should deal with the valid cases by
> default.
>
> Cheerio,
> Bennett.
> --
> Bennett McElwee
>
> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: Friday, 16 June 2006 11:39 pm
> To: JMeter Users List
> Subject: Re: &amp; in dynamic links
>
> As I thought, the &amp; appears in the HTML page source:
>
> <a
>
href="http://www.businesslink.gov.uk/bdotg/action/layer?r.s=tl&amp;topic
> Id=1073861197"
> title="Choose the right systems and suppliers"><abbr
> title="Information Technology">IT</abbr> &amp; e-commerce</a>
>
> However the link displays in the status bar (and link box when
selected)
> as:
>
>
http://www.businesslink.gov.uk/bdotg/action/layer?r.s=tl&topicId=1073861
> 197
>
> Using the link:
>
>
http://www.businesslink.gov.uk/bdotg/action/layer?r.s=tl&amp;topicId=107
> 3861197
>
> does not work; it goes back to the home page.
>
> Maybe there is a requirement for JMeter to provide some form of
> built-in URL decoding - the difficulty is knowing when to apply it.
> Not everything needs decoding...
>
> S
> On 16/06/06, martin.2.west@bt.com <martin.2.west@bt.com> wrote:
> >
> > The RE is layer\?r\.XX=(.+?)" where X is tl, l1, l2, l3
> >
> > And HTTP Request has
> >
> > /bdotg/action/layer?r.XX=${__BeanShell(fixAmps("${foreachVarXX}"))}
> >
> > The website is http://www.businesslink.gov.uk
> >
> > Martin West
> > 01252 778772
> >
> >
> > -----Original Message-----
> > From: sebb [mailto:sebbaz@gmail.com]
> > Sent: Thursday, June 15, 2006 11:24 PM
> > To: JMeter Users List
> > Subject: Re: &amp; in dynamic links
> >
> > To go back to the original problem - are you sure that the original
> > references use & and not &amp; ?
> >
> > The Regex extractor definitely won't encode &, and I don't think the
> > sampler does either.
> >
> > What does the Tree View Listener show for the result?
> >

This communication, including any attachments, is confidential. If you are not the intended
recipient, you should not read it - please contact me immediately, destroy it, and do not
copy or use any part of this communication or disclose anything about it. Thank you. Please
note that this communication does not designate an information system for the purposes of
the Electronic Transactions Act 2002.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message