예제 #1
0
파일: 07-codecs.c 프로젝트: Andrepuel/onion
void t07_codecs_html(){
	INIT_LOCAL();
	
	char *encoded=onion_html_quote("<\"Hello\">");
	FAIL_IF_NOT_EQUAL_STR( encoded, "&lt;&quot;Hello&quot;&gt;");
	free(encoded);
	
	END_LOCAL();
}
예제 #2
0
/**
 * @short Writes the given string to the res, but encodes the data using html entities
 * @ingroup response
 *
 * The encoding mens that <code><html> whould become &lt;html&gt;</code>
 */
ssize_t onion_response_write_html_safe(onion_response * res, const char *data) {
  char *tmp = onion_html_quote(data);
  if (tmp) {
    int r = onion_response_write0(res, tmp);
    onion_low_free(tmp);
    return r;
  } else
    return onion_response_write0(res, data);
}