Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Patching a scheme.

 [1/7] from: bga::bug-br::org::br at: 27-Jun-2005 13:23


To be able to set the Referer header in the HTTP request, I am trying to patch the HTTP scheme. I did some preliminary tests and I am having problems. Without changing anything in the scheme, I did this to save it in a file: write %http.r probe system/schemes/HTTP Then, to read it back, I did: system/schemes/HTTP: load %http.r This results in a crash (under Windows) when trying to use the HTTP protocol. Am I doing something wrong? -Bruno

 [2/7] from: petr:krenzelok:trz:cz at: 27-Jun-2005 21:02


Bruno G. Albuquerque wrote:
>To be able to set the Referer header in the HTTP request, I am trying to >patch the HTTP scheme. I did some preliminary tests and I am having
<<quoted lines omitted: 5>>
>This results in a crash (under Windows) when trying to use the HTTP >protocol. Am I doing something wrong?
Sorry, no crash here under 1.3.1. Have you tried with clean console session? -pekr-

 [3/7] from: hallvard::ystad::oops-as::no at: 27-Jun-2005 22:12


If you want to save to a file something that you will later load, I think (think!) you should 'save it, not 'write it.
>> help save
USAGE: SAVE where value /header header-data /bmp /png /all DESCRIPTION: Saves a value or a block to a file or url. SAVE is a native value. ARGUMENTS: where -- Where to save it. (Type: file url binary) value -- Value to save. (Type: any) REFINEMENTS: /header -- Save it with a header header-data -- Header block or object (Type: block object) /bmp -- Save in .BMP format /png -- Save in .PNG format /all -- Save in serialized format HY Dixit Bruno G. Albuquerque (18.23 27.06.2005):

 [4/7] from: volker:nitsch:gma:il at: 28-Jun-2005 10:17


On 6/27/05, Hallvard Ystad <[hallvard--ystad--oops-as--no]> wrote:
> If you want to save to a file something that you will later load, I think > (think!) you should 'save it, not 'write it. >
And to load it back, do it, not load it. it will look like make object! [ .. ] and thats code to make an object, not an object itself. (not tested if http works then, but with ftp) and remember to save/header, 'do checks for that with a file. Or don't and use [do load %http.r] later. Btw nice trick for dumping is with compose: save/header %http.r compose/only [ system/schemes/HTTP: (system/schemes/HTTP) ][Title: "my http"] And then just [do %http.r]
> >> help save > USAGE:
<<quoted lines omitted: 36>>
> To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject.
-- -Volker Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem. David Wheeler

 [5/7] from: gabriele:colellachiara at: 28-Jun-2005 11:10


Hi Volker, On Tuesday, June 28, 2005, 10:17:15 AM, you wrote: VN> And to load it back, do it, not load it. Or, use SAVE/ALL. Anyway - you don't need to change it. What you need is already there. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [6/7] from: volker::nitsch::gmail::com at: 28-Jun-2005 11:38


On 6/28/05, Gabriele Santilli <[gabriele--colellachiara--com]> wrote:
> Hi Volker, > > On Tuesday, June 28, 2005, 10:17:15 AM, you wrote: > > VN> And to load it back, do it, not load it. > > Or, use SAVE/ALL. >
No, he is saving code. (Gabriele knows the following, for others:) Save/all saves in an extended format, which can save more datatypes, like objects. makes loading them easier. but the loader explicitely breaks saved functions. Thats by intention, so that you can savely load data. if functions are in it, they cannot run, throwing an error. Without that one could easily inject virii if the code is not extremely cautious.
> Anyway - you don't need to change it. What you need is already > there.
<<quoted lines omitted: 6>>
> To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject.
-- -Volker Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem. David Wheeler

 [7/7] from: gabriele::colellachiara::com at: 28-Jun-2005 12:00


Hi Volker, On Tuesday, June 28, 2005, 11:38:58 AM, you wrote: VN> No, he is saving code. But, in that case, using WRITE is probably a better idea. Indeed, FORM has been changed in 1.3 to produce a nice human-readable format for objects. (I.e. to save configuration files and so on.) The format is intended to be used in pair with CONSTRUCT. So: write %prot-http.r system/schemes/http/handler edit it, add a header and so on, then: system/schemes/http/handler: make system/schemes/http/handler load %prot-http.r I think it would still be better to use NET-INSTALL, but for a quick patch the above may be useful. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted