Changing what's escaped when printing.

With this patch the model is:

    - "print" cleans the data so that non-printable characters get
      escaped. This is not necessarily reversible.

    - to print in a reversible way, one can go through
      escape_string(); this escapes backslashes as well to make the
      decoding non-ambigious.

    - Logging always escapes similar to escape_string(), making it
      reversible.

Compared to master, we also change the escaping as follows:

    - We now only escape with "\xXX", no more "^X" or "\0". Exception:
      backslashes.

    - We escape backlashes as "\\".

    - There's no "alternative" output style anymore, i.e., fmt() '%A'
      qualifier is gone.

Baselines in testing/btest are updated, external tests not yet.

Addresses BIT-1333.
This commit is contained in:
Robin Sommer 2015-04-15 09:59:09 -07:00
parent e41c623ad0
commit 7344052b50
66 changed files with 397 additions and 349 deletions

View file

@ -7,7 +7,7 @@ file #0, 555523, 0
[orig_h=10.101.84.70, orig_p=10978/tcp, resp_h=129.174.93.161, resp_p=80/tcp]
[orig_h=10.101.84.70, orig_p=10977/tcp, resp_h=129.174.93.161, resp_p=80/tcp]
FILE_BOF_BUFFER
%PDF-1.4^J%\xd0
%PDF-1.4\x0a%\xd0
MIME_TYPE
application/pdf
total bytes: 555523

View file

@ -5,7 +5,7 @@ FILE_STATE_REMOVE
file #0, 1022920, 0
[orig_h=192.168.72.14, orig_p=3254/tcp, resp_h=65.54.95.206, resp_p=80/tcp]
FILE_BOF_BUFFER
MZ\x90\0^C\0\0\0^D\0\0
MZ\x90\x00\x03\x00\x00\x00\x04\x00\x00
MIME_TYPE
application/x-dosexec
total bytes: 1022920
@ -22,6 +22,6 @@ FILE_STATE_REMOVE
file #1, 206024, 816896
[orig_h=192.168.72.14, orig_p=3257/tcp, resp_h=65.54.95.14, resp_p=80/tcp]
FILE_BOF_BUFFER
\x1b\xb8=\xb1\xff^PU^P\xce\xc3^
\x1b\xb8=\xb1\xff\x10U\x10\xce\xc3^
total bytes: 1022920
source: HTTP

View file

@ -7,7 +7,7 @@ file #0, 498668, 0
[orig_h=10.45.179.94, orig_p=19950/tcp, resp_h=129.174.93.170, resp_p=80/tcp]
[orig_h=10.45.179.94, orig_p=19953/tcp, resp_h=129.174.93.170, resp_p=80/tcp]
FILE_BOF_BUFFER
%PDF-1.4^M%\xe2
%PDF-1.4\x0d%\xe2
MIME_TYPE
application/pdf
total bytes: 498668