Bug! Rebol/View demo mode not able to read nbci site. Possibly not using
[1/2] from: al:bri:xtra at: 26-Sep-2000 20:57
Earlier, I wrote:
> The problem is actually due to Rebol's use of an incompatible (with other
browsers) value for http/user-agent.
If I change user-agent to this:
system/schemes/http/user-agent: rejoin [
"Mozilla" "/" "4.0"
" (Compatible; " system/schemes/http/user-agent ")"
]
and place it in %user.r for Rebol View, and use the console, I can read
my %index.r, %Roller.r and %Dice.r files on my site:
REBOL/View 0.10.34.3.1 25-Sep-2000
Copyright 2000 REBOL Technologies. All rights reserved.
>> system/schemes/http/user-agent
== "Mozilla/4.0 (Compatible; REBOL 0.10.34.3.1)"
>> read http://members.nbci.com/_XMCM/AndrewMartin/index.r
== {REBOL [Title: "Andrew's Rebol/View stuff."]
icon "Dice Roller" http://members.nbci.com/_XMCM/AndrewMartin/Roller.r
}
>> read http://members.nbci.com/_XMCM/AndrewMartin/Roller.r
== {[
Rebol [
^-Title: "Roller"
^-Name: 'Roller
^-File: %Roller.r
^-Author: "Andrew Martin"
^-Email: [Al--Bri--xtra--co--nz]
^-Date: 25/S...
>> read http://members.nbci.com/_XMCM/AndrewMartin/Dice.r
== {[
Rebol [
^-Title: "Dice"
^-Name: 'Dice
^-File: %Dice.r
^-Author: "Andrew Martin"
^-Email: [Al--Bri--xtra--co--nz]
^-Date: 19/Sep/200...
Yet, if I enter demo mode:
>> demo
and click several times to access my site on the rebol/web, Rebol can't
read:
http://members.nbci.com/_XMCM/AndrewMartin/index.r
yet it can back in console mode:
REBOL/View 0.10.34.3.1 25-Sep-2000
Copyright 2000 REBOL Technologies. All rights reserved.
>> read http://members.nbci.com/_XMCM/AndrewMartin/index.r
== {REBOL [Title: "Andrew's Rebol/View stuff."]
icon "Dice Roller" http://members.nbci.com/_XMCM/AndrewMartin/Roller.r
}
>> system/schemes/http/user-agent
== "Mozilla/4.0 (Compatible; REBOL 0.10.34.3.1)"
So there's something wrong now with demo mode code? Or perhaps it's not
using the changed http/user-agent?
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
http://members.xoom.com/AndrewMartin/
[2/2] 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-