Partial read via HTTP Range
header works fine for me:
rebol []
client: open tcp://www.apache.org/
client/awake: func [event /local port] [
port: event/port
switch event/type [
lookup [open port]
connect [
write port rejoin [
{GET / HTTP/1.1} crlf
{User-Agent: curl/7.26.0} crlf
{Host: www.apache.org} crlf
{Accept: */*} crlf
{Range: bytes=0-9} crlf
crlf
]
]
wrote [read port]
read [
probe to-string port/data
probe length? port/data
clear port/data
]
]
false
]
wait [client 3]
close client
print "Done"
I think I could use READ/PART to do the same thing:
length? read/part http://www.apache.org/ 10 ;40195
length? read http://www.apache.org/ ;40195
but it does't work, still get all the bytes. The same with READ/SEEK
.
Why was that?
(By the way, it works in Rebol2.)