Re: [PATCH 3/8] Skip forbidden characters.

2014-07-02 Thread Andreas Zwinkau
I asked Sebastian (commit author) about this old (Jan 2012) commit. It
fixed some breakage of some feed reader. Unfortunately, the real
reason is lost in time.

The change essentially filters out characters like (bell) or (record
separator) from HTML. Testing with my Google Chrome, \t\n\r are
rendered, the rest is skipped even inside .

Conclusion: It should probably not break anything. However, it should
not make a difference anyways. Just a workaround for some unknown bug.

On Tue, Jul 1, 2014 at 10:29 PM, John Keeping  wrote:
> On Tue, Jul 01, 2014 at 09:40:28AM +0200, zwin...@kit.edu wrote:
>> From: Sebastian Buchwald 
>
> Why do we want to do this?  Does it not break anything that uses
> whitespace="pre" (explicitly or implicitly)?
>
>> ---
>>  html.c | 9 ++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/html.c b/html.c
>> index 91047ad..6037eec 100644
>> --- a/html.c
>> +++ b/html.c
>> @@ -129,7 +129,8 @@ void html_txt(const char *txt)
>>   const char *t = txt;
>>   while (t && *t) {
>>   int c = *t;
>> - if (c == '<' || c == '>' || c == '&') {
>> + if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
>> + || (c == '<' || c == '>' || c == '&')) {
>>   html_raw(txt, t - txt);
>>   if (c == '>')
>>   html(">");
>> @@ -150,7 +151,8 @@ void html_ntxt(int len, const char *txt)
>>   const char *t = txt;
>>   while (t && *t && len--) {
>>   int c = *t;
>> - if (c == '<' || c == '>' || c == '&') {
>> + if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
>> + || (c == '<' || c == '>' || c == '&')) {
>>   html_raw(txt, t - txt);
>>   if (c == '>')
>>   html(">");
>> @@ -186,7 +188,8 @@ void html_attr(const char *txt)
>>   const char *t = txt;
>>   while (t && *t) {
>>   int c = *t;
>> - if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == 
>> '&') {
>> + if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&'
>> + || (c < 0x20 && c != '\t' && c != '\n' && c != 
>> '\r')) {
>>   html_raw(txt, t - txt);
>>   if (c == '>')
>>   html(">");
> ___
> CGit mailing list
> CGit@lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit



-- 
Andreas Zwinkau

work email: zwin...@kit.edu
private email: q...@web.de
homepage: http://beza1e1.tuxen.de
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH 3/8] Skip forbidden characters.

2014-07-01 Thread John Keeping
On Tue, Jul 01, 2014 at 09:40:28AM +0200, zwin...@kit.edu wrote:
> From: Sebastian Buchwald 

Why do we want to do this?  Does it not break anything that uses
whitespace="pre" (explicitly or implicitly)?

> ---
>  html.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/html.c b/html.c
> index 91047ad..6037eec 100644
> --- a/html.c
> +++ b/html.c
> @@ -129,7 +129,8 @@ void html_txt(const char *txt)
>   const char *t = txt;
>   while (t && *t) {
>   int c = *t;
> - if (c == '<' || c == '>' || c == '&') {
> + if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
> + || (c == '<' || c == '>' || c == '&')) {
>   html_raw(txt, t - txt);
>   if (c == '>')
>   html(">");
> @@ -150,7 +151,8 @@ void html_ntxt(int len, const char *txt)
>   const char *t = txt;
>   while (t && *t && len--) {
>   int c = *t;
> - if (c == '<' || c == '>' || c == '&') {
> + if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
> + || (c == '<' || c == '>' || c == '&')) {
>   html_raw(txt, t - txt);
>   if (c == '>')
>   html(">");
> @@ -186,7 +188,8 @@ void html_attr(const char *txt)
>   const char *t = txt;
>   while (t && *t) {
>   int c = *t;
> - if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') 
> {
> + if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&'
> + || (c < 0x20 && c != '\t' && c != '\n' && c != 
> '\r')) {
>   html_raw(txt, t - txt);
>   if (c == '>')
>   html(">");
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH 3/8] Skip forbidden characters.

2014-07-01 Thread zwinkau
From: Sebastian Buchwald 

---
 html.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c
index 91047ad..6037eec 100644
--- a/html.c
+++ b/html.c
@@ -129,7 +129,8 @@ void html_txt(const char *txt)
const char *t = txt;
while (t && *t) {
int c = *t;
-   if (c == '<' || c == '>' || c == '&') {
+   if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
+   || (c == '<' || c == '>' || c == '&')) {
html_raw(txt, t - txt);
if (c == '>')
html(">");
@@ -150,7 +151,8 @@ void html_ntxt(int len, const char *txt)
const char *t = txt;
while (t && *t && len--) {
int c = *t;
-   if (c == '<' || c == '>' || c == '&') {
+   if ((c < 0x20 && c != '\t' && c != '\n' && c != '\r')
+   || (c == '<' || c == '>' || c == '&')) {
html_raw(txt, t - txt);
if (c == '>')
html(">");
@@ -186,7 +188,8 @@ void html_attr(const char *txt)
const char *t = txt;
while (t && *t) {
int c = *t;
-   if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') 
{
+   if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&'
+   || (c < 0x20 && c != '\t' && c != '\n' && c != 
'\r')) {
html_raw(txt, t - txt);
if (c == '>')
html(">");
-- 
1.9.1

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit