Morpheus (was: set-net question. No, TWOquestions)
[1/10] from: petr:krenzelok:trz:cz at: 30-Oct-2001 10:03
Hallvard Ystad wrote:
> Petr Krenzelok skrev (Tuesday 30.10.2001, kl. 08.57):
> > > >Inside the 'open func in system/schemes/http/handler I find the
<<quoted lines omitted: 9>>
> >http-accept-header??
> I mean the Accept: "*/*" header, as seen above. Certain browsers cannot
huh, what is the problem of re-setting the word upon your need then?
Although 'create-request seems to be pretty nested, you can:
write %my-http-handler.txt mold system/schemes/http/handler
...then change its source, and rebind it back in your user.r file:
system/schemes/http/handler: load %my-http-handler.txt
But I am not sure if it is secure way to do so, as RT can change handler code
in future releases ...
One other note - do you know the difference in none vs false in protocol
schemes settings? If you use e.g. system/schemes/ftp/user: none, it will look
at parent scheme - system/schemes/default for 'user field setting, and if
present, it will override your none above. If you want to prevent it, just use
system/schemes/ftp/user: false e.g. I hope I do remember it correctly :-)
Cheers,
-pekr-
[2/10] from: hallvard:ystad:helpinhand at: 30-Oct-2001 11:12
Petr Krenzelok skrev (Tuesday 30.10.2001, kl. 10.03):
>huh, what is the problem of re-setting the word upon your need then?
I wanted a simple, neat way to do it. I'm inside a CGI script that fetches
a url, extracts some information and writes it out. I could rebind
system/schemes/http/handler in user.r, but the accpet-setting isn't static!
I find it very... bothersome! to have to rebind system/schemes/http/handler
several times in the script.
>But I am not sure if it is secure way to do so, as RT can change handler
>code
>in future releases ...
..and that's another point, yes.
>One other note - do you know the difference in none vs false in protocol
>schemes settings? If you use e.g. system/schemes/ftp/user: none, it will
<<quoted lines omitted: 3>>
>use
>system/schemes/ftp/user: false e.g. I hope I do remember it correctly :-)
I'll check it out. Thnaks-
~H
[3/10] from: cyphre::seznam::cz at: 30-Oct-2001 12:35
Hi Halvard,
here you are two(either for /core 2.5 or /View1.2.1) little ugly
hard-patches for your needs:
--------try this on start of your View script--------
poke first at first at second get in system/schemes/http/handler 'open 17 4
2 "your-new-value"
--------end of hack for REBOL/View 1.2.1.3.1 21-Jun-2001--------
--------try this on start of your Core script--------
poke first at second get in system/schemes/http/handler 'open 15 2
your-new-value
--------end of hack REBOL/Core 2.5.0.3.1--------
Althourgh I didn't test them I hope this will change HTTP-Get-Header/Accept
value as you want.
Let me know if it works. I'm just curious ;)
regards
Cyphre
[4/10] from: brett:codeconscious at: 30-Oct-2001 23:10
I just worked out how to test it - run a little local rebol webserver that
shows the connection requests.
The following successfully changed the user-agent field of the header. Very
rebol ;-)
read/custom http://localhost:8000/ [header [User-Agent: "bretts agent"]]
Brett.
[5/10] from: hallvard:ystad:helpinhand at: 30-Oct-2001 13:06
Cyphre skrev (Tuesday 30.10.2001, kl. 12.35):
>poke first at second get in system/schemes/http/handler 'open 15 2
>"your-new-value"
Worked fine, thanks.
Setting headers like this is a bit dumb. I even feel that 'send should be
simpler. When I want to send an email with, say "X-diddely-do: hello!" in
the header, I am forced to make a complete header-object, thus:
send/header [hallvard--ystad--helpinhand--com] "test" make object!
[X-diddely-do: "hello!" from: none to: none date: none]
The three nones are there for rebol to use my default settings. A simpler
and more reasonable way to do it, in my opinion, would be like this:
send/header [hallvard--ystad--helpinhand--com] "test" [X-diddely-do: "hello!"]
Rebol could then simply add [X-diddely-do: "hello!"] to the other headers.
In the same way, read could have a refinement like this:
read/header http://www.rebol.com/ [Accept: "text/html" user-agent: "007"]
I hope something like this will be implemented in future releases...
~H
PS. Is there any good documentation for the /custom refinement block
dialect in 'read anywhere?
[6/10] from: deadzaphod:flyingparty at: 30-Oct-2001 4:20
> Setting headers like this is a bit dumb. I even feel that 'send should be
> simpler. When I want to send an email with, say "X-diddely-do: hello!" in
<<quoted lines omitted: 4>>
> and more reasonable way to do it, in my opinion, would be like this:
> send/header [hallvard--ystad--helpinhand--com] "test" [X-diddely-do: "hello!"]
well, we can already do:
send/header [hallvard--ystad--helpinhand--com] "test" make
system/standard/email [X-diddely-do: "hello!"]
it might be better if send/header did the make implicitly, but this isn't
too bad (once you find the standard email object).
Cal
[7/10] from: petr:krenzelok:trz:cz at: 30-Oct-2001 13:29
Cal Dixon wrote:
> > Setting headers like this is a bit dumb. I even feel that 'send should be
> > simpler. When I want to send an email with, say "X-diddely-do: hello!" in
<<quoted lines omitted: 10>>
> send/header [hallvard--ystad--helpinhand--com] "test" make
> system/standard/email [X-diddely-do: "hello!"]
OK, then everything is solvable - put following into your user.r
using: func [blk][make system/standard/email blk]
send/header [hallvard--ystad--helpinhand--com] "test" using [X-diddely-do: "hello!"]
btw: as for 3 nones - you don't need to use none 3 times. Rebol allowes you to
use following construct too - context [a: b: c: d: none] to explicitly set all
values ...
-pekr-
[8/10] from: hallvard:ystad:helpinhand at: 30-Oct-2001 13:33
Brett Handley skrev (Tuesday 30.10.2001, kl. 13.10):
>The following successfully changed the user-agent field of the header.
>Very
>rebol ;-)
> read/custom http://localhost:8000/ [header [User-Agent: "bretts
> agent"]]
That's funny, because it didn't change anything when I tried. What could be
the difference? I'm testing from a win2k machine using /core version
2.5.0.3.1.
~H
[9/10] from: hallvard:ystad:helpinhand at: 30-Oct-2001 13:36
Cal Dixon skrev (Tuesday 30.10.2001, kl. 13.20):
>well, we can already do:
>
> send/header [hallvard--ystad--helpinhand--com] "test" make
>system/standard/email [X-diddely-do: "hello!"]
Sounds real good, but:
>> send/header [hallvard--ystad--helpinhand--com] "test" make
system/standard/email [X-di
ddely-do: "hello!"]
connecting to: helpinhand.com
** Access Error: Port none not open
** Where: confirm
** Near: result: make string! (20 * length? words)
foreach
~H
[10/10] from: lmecir:mbox:vol:cz at: 30-Oct-2001 13:43
Hi,
how about:
send/header [hallvard--ystad--helpinhand--com] "test" make
system/standard/email [X-diddely-do: "hello!"]
or:
sh: func [email [email!] text [string!] spec [block!]] [
send/header email text make system/standard/email block
]
and then
sh [hallvard--ystad--helpinhand--com] "test" [X-diddely-do: "hello!"]
Cheers
Ladislav
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted