mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-23 21:22:17 +00:00
MINOR: buffer: align the last output line of buffer_dump()
If the dumped length of buffer is not multiple of 16, the last output line can be seen as below: Dumping contents from byte 0 to byte 125 0 1 2 3 4 5 6 7 8 9 a b c d e f 0000: 47 45 54 20 2f 69 6e 64 - 65 78 2e 68 74 6d 20 48 GET /index.htm H 0010: 54 54 50 2f 31 2e 30 0d - 0a 55 73 65 72 2d 41 67 TTP/1.0..User-Ag ... 0060: 30 0d 0a 43 6f 6e 6e 65 - 63 74 69 6f 6e 3a 20 4b 0..Connection: K 0070: 65 65 70 2d 41 6c 69 76 - 65 0d 0a 0d 0a eep-Alive.... Yes, the hex column will be overlapped by the text column. Both the hex and text column should be aligned at their own area as below: Dumping contents from byte 0 to byte 125 0 1 2 3 4 5 6 7 8 9 a b c d e f 0000: 47 45 54 20 2f 69 6e 64 - 65 78 2e 68 74 6d 20 48 GET /index.htm H 0010: 54 54 50 2f 31 2e 30 0d - 0a 55 73 65 72 2d 41 67 TTP/1.0..User-Ag ... 0060: 30 0d 0a 43 6f 6e 6e 65 - 63 74 69 6f 6e 3a 20 4b 0..Connection: K 0070: 65 65 70 2d 41 6c 69 76 - 65 0d 0a 0d 0a eep-Alive.... Signed-off-by: Godbach <nylzhaowei@gmail.com>
This commit is contained in:
parent
0bb166be5e
commit
c08057cc3f
@ -215,6 +215,11 @@ void buffer_dump(FILE *o, struct buffer *b, int from, int to)
|
||||
if (((from + i) & 15) == 7)
|
||||
fprintf(o, "- ");
|
||||
}
|
||||
if (to - from < 16) {
|
||||
int j;
|
||||
for (j = 0; j < from + 16 - to; j++)
|
||||
fprintf(o, " ");
|
||||
}
|
||||
fprintf(o, " ");
|
||||
for (i = 0; (from + i < to) && (i < 16) ; i++) {
|
||||
fprintf(o, "%c", isprint((int)b->data[from + i]) ? b->data[from + i] : '.') ;
|
||||
|
Loading…
Reference in New Issue
Block a user