[REBOL] Bug! Rebol/View demo mode not able to read nbci site. Possibly not using
From: petr::krenzelok::trz::cz at: 26-Sep-2000 11:43
[Al--Bri--xtra--co--nz] wrote:
> So there's something wrong now with demo mode code? Or perhaps it's not
> using the changed http/user-agent?
>
OK. There's more problems with demo mode. There's function read-net and it
seems to use direct tcp connection, ignoring default scheme settings. It
currently can't go thru firewall too, although someone posted here some
workaround. OK, I found it:
;; This function is a replace for the not proxy-capable "read-net"
;; of th actual REBOL/View release
;; simply append it to your user.r
read-net: func [
{Read a file from the net (web). Update progress bar. Allow abort.}
host-name
path
/progress callfunc port-hand
/local port buffer hdr-brk get-data body time data errc size wholepath
][
if error? try [
port: open/direct/binary/no-wait [scheme: 'tcp host:
system/schemes/default/proxy/host port-id:
system/schemes/default/proxy/port-id]
wholepath: rejoin ["http://" host-name path]
] [return none]
insert port rejoin [
"GET " wholepath " HTTP/1.0" crlf
"User-Agent: REBOL/View " system/version crlf
"Accept: */*" crlf
"Host: " host-name crlf
"Connection: close" crlf
crlf
]
buffer: make binary! 4000
hdr-brk: rejoin [crlf crlf]
size: none
errc: 900
get-data: func [port] [
if none? data: copy port [close port return 'break]
append buffer data
if all [not size body: find/tail buffer hdr-brk] [
parse buffer [
"HTTP" thru " " copy errc [to " " | to newline] (errc:
load/all errc)
thru "Content-length:" copy size to newline]
if errc > 299 [close port return 'break]
size: either size [to-integer trim size] [10000]
remove/part buffer body
buffer: make binary! size + 32
append buffer head body
]
if all [size progress] [callfunc size length? buffer]
]
dispatch append copy any [port-hand []] [
port :get-data
30 [print "TIMEOUT***********" close port 'break]
]
if errc < 300 [return buffer]
]
Regards
Jochen Schmidt
---------------------------------------------
you can change user agent there ....
Cheers,
-pekr-