This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
tesla1889's profile picture

slight modification to HTTP (affects returned file handle only)

Started by tesla1889, 11 February 2013 - 10:52 AM
tesla1889 #1
Posted 11 February 2013 - 11:52 AM
the current problem with the http api is that the read mode of the file handle returned is in text mode instead of binary mode

my suggestion is to add an optional read mode to the functions that will determine the file handle's read mode



documentation:

http.get( string url [, string mode] )

http.post( string url, string postData [, string mode] )

http.request( string url [, string postData [, string mode] ] )
Cloudy #2
Posted 11 February 2013 - 12:15 PM
It isn't a real file handle so it isn't that simple. I do want to expand http though - watch this space.
tesla1889 #3
Posted 11 February 2013 - 01:37 PM
It isn't a real file handle so it isn't that simple. I do want to expand http though - watch this space.

i know it isnt Java, and i dont know much about Java, but the C++ http api returns a file handle for the socket on success. could that be returned as userdata for the Lua environment?
Cloudy #4
Posted 11 February 2013 - 02:09 PM
What makes you think the C++ environment has any relation? It doesn't.
tesla1889 #5
Posted 11 February 2013 - 06:43 PM
ok. cool.