Reading post "r13/r1/r1/1" [Mail Boardmaster] [Main] [Help]
SUBJECT: RE:RE:links & RT
On Fri, Jan. 4, 2002 - 13:44:46, stieu wrote:

On Tue, Jan. 1, 2002 - 23:26:11, rick wrote:

> On Sun, Dec. 9, 2001 - 18:59:25, briant wrote:
> > Do you mean the text-based Lynx browser? I'm not too sure what you mean by it being double spaced?
> Links is the same idea as lynx - text based - but understands frames. My
> replies were double-spaced (you'll see a couple examples in RT). I've
> broken down and started using Netscape.

There is a bug in the links program.

SYMPTOM:
I did a "par" (equiv to linux's strace) on it and found out that it submitted
comments via the "POST" method like this:
...do_req_give=true&content=still+trying+to get+to+the bottom..
Notice the 3F That's {CarriageReturn}{CarriageReturn}{NewLine}
When I "par" netscape I got this:
..do_req_give=true&content= more+testing this+is+a+test..
This is the correct way of doing things. Each line should only
have {CarriageReturn}{NewLine}.

PROBLEM:
In the links source code, view.c file, the encode_textarea() procedure does
a conversion from "\n" to "\r\n". The problem is that it gets executed twice!

SOLUTION:
I don't know the inner working of links so I won't just arbitrarily remove one.
However, if I add a "check-if-textarea-is-encoded", it seems to work
just fine. Here is the modification to links 0.96 (latest) in
the "view.c" file. Replace the encode_textarea procedure in line 1054
with this:

unsigned char *encode_textarea(unsigned char *t)
{
int len =0;
int encoded_already;
unsigned char *o =init_str();
encoded_already=(int)strchr(t,'\r');
for (; *t; t++) {
/*
if (*t !='\n') add_chr_to_str(&o, &len, *t);
else add_to_str(&o, &len, "\r\n");
*/
if((*t !='\n')||encoded_already) add_chr_to_str(&o, &len, *t);
else add_to_str(&o, &len, "\r\n");
}
return o;
}

And yes, I did check trace to see if it does indeed post with " " and
no extra " ".


Here is a copy of my view.c (70k in size) file modified from links-0.96.

Include text of this message
with your response