Bug 55710 - XML headers strings are not parsed correctly within a Rivet Page
Summary: XML headers strings are not parsed correctly within a Rivet Page
Status: NEW
Alias: None
Product: Rivet
Classification: Unclassified
Component: mod_rivet (show other bugs)
Version: 2.1.3
Hardware: Other Linux
: P2 minor
Target Milestone: mod_rivet
Assignee: Apache Rivet Mailing list account
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 21:30 UTC by Brice
Modified: 2016-11-16 23:22 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brice 2013-10-25 21:30:17 UTC
Under a tclsh, if you type this command, you get:

% set res{<?xml version='1.0' encoding='utf-8'?><rows><page>0</page><total>0</total></rows>}
<?xml version='1.0' encoding='utf-8'?><rows><page>0</page><total>0</total></rows>

All is fine.

But within a rivet page,

<?
set res {<?xml version='1.0' encoding='utf-8'?><rows><page>0</page><total>0</total></rows>}
?>

you get:

[Thu Oct 24 17:00:52 2013] [error] RivetErrorScript called!: missing close-brace\n    while executing\n"namespace eval request {"

So a perfectly correct TCL string set with { } is parsed incorrectly within the rivet parser.

It is minor but a reference at it should be in the documentation.
We might want to add dual markers <rvt and <? for backward compatibility?
Comment 1 Ronnie Brunner 2015-05-07 20:28:51 UTC
For what it's worth: In Websh we allow properly nested tags and for cases where they're not properly nested, you can escape them with a '\'. By default, Websh uses braces for embedded scripts, but this can be configured to tags with

   web::config putxmarkup tag

So, this is valid (and working as expected):

<?
set res {<?xml version='1.0' encoding='utf-8'?><rows><page>0</page><total>0</total></rows>}
?>

but invalid would be (not properly nested: 

<?
set res {?>xml version='1.0' encoding='utf-8'<?<rows><page>0</page><total>0</total></rows>}
?>

Doesn't make much sense, I know, but to make that a valid statement (though pretty useless), you'd escape as follows:

<?
set res {\?>xml version='1.0' encoding='utf-8'\<?<rows><page>0</page><total>0</total></rows>}
?>

This could be an option for you to solve that rather than adding <rvt a alternative ending up needing both rvt> and ?> in the same statement, just as in this sentence. :-)
Comment 2 Jeff Lawson 2015-05-07 23:25:02 UTC
You can use backslashes to break up the magic character sequence so that Rivet does not get confused by it, though you have to use double-quotes instead of braces.

<?
set res "<\?xml version='1.0' encoding='utf-8'?\><rows><page>0</page><total>0</total></rows>"

?>
Comment 3 Massimo Manghi 2016-11-16 23:22:30 UTC
Hi Brice, this bug has been around for quite a long time now, can you provide a patch to be applied to the parser? We may consider changing the unsung hero of Rivet (the Rivet parser) for Rivet 3.0 (code in trunk). If we want to modify it it's perhaps the right time to dare a patch for this fundamental component

 -- Massimo