Posted 14 December 2013 - 06:16 PM
ComputerCraft Version Info:
1.57 Client/1.57 Server
Description of Bug:
When using the HTTP API to download a file from a web server and process the data, certain bytes in the data differ from the original and new bytes are added in their place. This can be observed through the string.byte function built into Lua, as the bytes can be iterated and printed as integers through this function.
An example of this is a file containing the bytes (represented as hex):
When generating a string containing these bytes in ComputerCraft through Lua's inbuilt string functions, they produce the correct results when converted back into integral representations of bytes. However, if this file is hosted on a web server and obtained using code such as the following:
Steps to reproduce:
1.57 Client/1.57 Server
Description of Bug:
When using the HTTP API to download a file from a web server and process the data, certain bytes in the data differ from the original and new bytes are added in their place. This can be observed through the string.byte function built into Lua, as the bytes can be iterated and printed as integers through this function.
An example of this is a file containing the bytes (represented as hex):
FF FF FF F6
When generating a string containing these bytes in ComputerCraft through Lua's inbuilt string functions, they produce the correct results when converted back into integral representations of bytes. However, if this file is hosted on a web server and obtained using code such as the following:
handle = http.get("http://website.com/file.txt")
data = handle.readAll()
the bytes appear to differ from the original ones in the file.Steps to reproduce:
- Create a file on a web server containing the bytes (represented as hex)
- Read the file using the http API of ComputerCraft and store the data into a variable
- Convert the data to an array of bytes represented as integers (can be done using string.byte(variable, 1, -1))
- Print out the data, and compare it to the integer representations of the original data
FF FF FF F6