

Or checking for s.avail_in != 0 for the while loop. If s.avail_out = 0 after deflate, that means compression used up all the spaces of out buffer, and we need to recall deflate() to deal with the bytes it didn't read/compressed. So, to mitigate this problem, a loop needs to surround deflate() and check whether the available out buffer(s.avail_out) is empty or not. If deflate doesn't read all the input bytes? (if s.avail_in > 0) It just ignores the bytes it didn't read, and overwrites them with the next bytes in the file! So those bytes never get compressed and sent! Thank You user253751 for figuring out the issue. So it seems that the issue here is probably due to the read buffer loop which probably caused some bytes to be exchanged or omitted? When modifying the buffer size, the width if the distortion changes, as shown below with MAXLINE = 2000:Īnd with MAXLINE = 7000, the distortion disappears, but with a white line at the bottom: Moreover, by experimenting with different settings. So the editor highlights highlights when there is same data? But then why didn't it highlight the first line? Since the above difference was not highlighted by wxHe圎ditor, while in a different line with offset 0552380, only the same C7 was highlighted.

#WXHEXEDITOR HIGHLIGHT EVERYTHIN HOW TO#
I'm not sure how to interpret the result from this comparison, since this is my first time using a hex editor, and also the comparison highlighting was confusing to me. DA E0 B4) is identical in both files, but the next line with offset 0552000 (7C 92 77. Some row are identical, while some are not.įor example, line with offset 0551980 (first line, 01 44 87.There are a lot of bytes missing at the end, as shown in the screen shot below (Left is downloaded, Right is original):.But, I'm not sure why and how to fix this.īy comparing both original image and downloaded image using a hex editor, I found out that: So most probably is the gzip compression that causes this problem.

only chunking), the image was not distorted at all. So there is no distortion happening to sending a text file with gzip and chunking.Īlso, before adding the gzip compression (ie. I have tested this using a large text file as suggested by user253751 from the comment, and the downloaded text file has identical content.
#WXHEXEDITOR HIGHLIGHT EVERYTHIN CODE#
I suspects that there are some problems with the code for writing to socket with gzip and chunked transfer, but I can't seem to figure out the problem.Īny idea why this happened? And why it causes problems for images but not other file type such as pdfs? Any idea how to fix this? Thank You. However, when I try to request an image, the displayed/ downloaded image are distorted as follows: And they could be downloaded by the browser without any problems or corruption. The above code works fine, when the requested file is pdf, html, pptx.
