- client: when writing XML, entity-encode the following fields:

FILE_INFO::url
    HOST_INFO::p_vendor, p_model, p_features, os_name, os_version

    The following fields are already entity-encoded:
    PROJECT::user_name, team_name
    APP_INIT_DATA::user_name, team_name
    PROXY_INFO:: user names and passwds

    These are (as far as I know) the only fields that can
    contain special chars.
    This is now documented in:
    http://boinc.berkeley.edu/trac/wiki/XmlNotes
- client: XML_PARSER::parse_str() now does xml_unescape(),
    same as ::parse_str().


svn path=/trunk/boinc/; revision=18915
This commit is contained in:
David Anderson 2009-08-25 21:32:39 +00:00
parent f4ec505ef8
commit dbd7b8b8e9
5 changed files with 42 additions and 7 deletions

View File

@ -7200,3 +7200,26 @@ David 24 Aug 2009
client_types.cpp
lib/
coproc.cpp,h
David 25 Aug 2009
- client: when writing XML, entity-encode the following fields:
FILE_INFO::url
HOST_INFO::p_vendor, p_model, p_features, os_name, os_version
The following fields are already entity-encoded:
PROJECT::user_name, team_name
APP_INIT_DATA::user_name, team_name
PROXY_INFO:: user names and passwds
These are (as far as I know) the only fields that can
contain special chars.
This is now documented in:
http://boinc.berkeley.edu/trac/wiki/XmlNotes
- client: XML_PARSER::parse_str() now does xml_unescape(),
same as ::parse_str().
client/
client_types.cpp
lib/
hostinfo.cpp
parse.cpp

View File

@ -845,6 +845,7 @@ int FILE_INFO::parse(MIOFILE& in, bool from_server) {
int FILE_INFO::write(MIOFILE& out, bool to_server) {
unsigned int i;
int retval;
char buf[1024];
out.printf(
"<file_info>\n"
@ -874,7 +875,8 @@ int FILE_INFO::write(MIOFILE& out, bool to_server) {
if (strlen(file_signature)) out.printf(" <file_signature>\n%s</file_signature>\n", file_signature);
}
for (i=0; i<urls.size(); i++) {
out.printf(" <url>%s</url>\n", urls[i].c_str());
xml_escape(urls[i].c_str(), buf, sizeof(buf));
out.printf(" <url>%s</url>\n", buf);
}
if (!to_server && pers_file_xfer) {
retval = pers_file_xfer->write(out);

View File

@ -1,6 +1,10 @@
<?
$project_news = array(
array("August 24, 2009",
"UNITAR, UNIGE and CERN have agreed to collaborate on a <a href=http://www.unitar.org/citizen_cyberscience_centre_project>Citizen Cyberscience Centre</a>
which, among other things, will promote volunteer computing."
),
array("August 19, 2009",
"The EDGeS project is offering a
<a href=http://edges-grid.eu/web/userforum/3rdtraining>tutorial on

View File

@ -111,6 +111,7 @@ int HOST_INFO::parse(MIOFILE& in) {
// or in a scheduler request message
//
int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
char pv[265], pm[256], pf[256], osn[256], osv[256]
out.printf(
"<host_info>\n"
" <timezone>%d</timezone>\n",
@ -124,6 +125,11 @@ int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
ip_addr
);
}
xml_escape(p_vendor, pv, sizeof(pv));
xml_escape(p_model, pm, sizeof(pm));
xml_escape(p_features, pf, sizeof(pf));
xml_escape(os_name, osn, sizeof(osn));
xml_escape(os_version, osv, sizeof(osv));
out.printf(
" <host_cpid>%s</host_cpid>\n"
" <p_ncpus>%d</p_ncpus>\n"
@ -144,9 +150,9 @@ int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
"</host_info>\n",
host_cpid,
p_ncpus,
p_vendor,
p_model,
p_features,
pv,
pm,
pf,
p_fpops,
p_iops,
p_membw,
@ -156,8 +162,8 @@ int HOST_INFO::write(MIOFILE& out, bool suppress_net_info) {
m_swap,
d_total,
d_free,
os_name,
os_version
osn,
osv
);
return 0;
}

View File

@ -617,7 +617,7 @@ bool XML_PARSER::parse_str(
if (eof) return false;
if (!is_tag) return false;
if (strcmp(tag, end_tag)) return false;
strlcpy(buf, tmp, len);
xml_unescape(tmp, buf, len);
return true;
}