World: r3wp
[!REBOL3 Schemes] Implementors guide
older newer | first last |
Graham 5-Jan-2010 [51x2] | Ok. |
And there's this in prot-http.r crlfbin: #{0D0A} crlf2bin: #{0D0A0D0A} crlf2: to string! crlf2bin This stuff should be in some reusable module too | |
BrianH 5-Jan-2010 [53x2] | prot-http.r is itself a reusable module. |
I think that the preprocessor will actually mix in the mixins itself, as if they were part of the original source of the calling modules. That way if you want to do selective import you would split your module into two, one that contains the shared stuff, and another that contains the local stuff that references the shared module. It's not as hard as it sounds. | |
Graham 5-Jan-2010 [55] | maybe instead of make-scheme there could be something like make-network-scheme where these are automatically accessible? |
BrianH 5-Jan-2010 [56] | How about let's worry about the refactoring later, and focus on getting it to work now. We can refactor on the way. |
Graham 5-Jan-2010 [57x2] | still leads to duplication of code |
yeah .. always put off today what can be done tomorrow :) | |
BrianH 5-Jan-2010 [59] | Which we can deduplicate during the refactoring :) |
Graham 5-Jan-2010 [60] | Kaj raised the point of how much memory r2 and r3 take compared with the clone ... |
BrianH 5-Jan-2010 [61] | Yes, another point for the refactoring. The clone doesn't do as much though. |
Graham 5-Jan-2010 [62x4] | read and write are very similar ... can we do this? read: func [ port [port!] /write data ] [ either any-function? :port/awake [ unless open? port [cause-error 'Access 'not-open port/spec/ref] if port/state/state <> 'ready [http-error "Port not ready"] port/state/awake: :port/awake do-request port port ] [ sync-op port either write [ data ] [[]] ] ] write: func [ port [port!] value ] [ unless any [block? :value any-string? :value] [value: form :value] unless block? value [value: reduce [[Content-Type: "application/x-www-form-urlencoded; charset=utf-8"] value]] read/write port data ] |
should be read/write port [parse-write-dialect port value] | |
well... can't use /write as the refinement .. but the idea ... | |
heh ..Gabriele must be top down programming .. .he writes the higher order code first and then the supporting definitions. | |
BrianH 5-Jan-2010 [66] | He programs in the RLP and then it topologically sorts the code. |
Graham 5-Jan-2010 [67] | Dunno what that means .. but it's the same in the rlp |
BrianH 5-Jan-2010 [68] | Ah, less topological sorting than I thought. |
Graham 5-Jan-2010 [69x3] | Which is the latest ... prot-http.rlp or prot-http.r ? |
later .. | |
ie. is prot-http.r generated from the rebol literate programming document? | |
BrianH 5-Jan-2010 [72x2] | prot-http.r is the latest. prot-http.rlp was just uploaded later. |
The original prot-http.r was generated from .rlp, but has since been revised directly. Look at the revision history with LF and DIFF. | |
Graham 5-Jan-2010 [74x2] | ok, I see this spec/headers: third make make object! [ in the rlp, and in the .r spec/headers: body-of make make object! [ |
so they are different. | |
BrianH 5-Jan-2010 [76] | body-of would work, third wouldn't. |
Graham 5-Jan-2010 [77x2] | so the rlp is correct? and the .r is not ? |
reverse that ... | |
BrianH 5-Jan-2010 [79] | The .rlp version is more than 2 years old, the .r is more recent and works. |
Graham 5-Jan-2010 [80] | oh ...ok. |
BrianH 5-Jan-2010 [81] | works, sort-of, still needs work. |
Graham 5-Jan-2010 [82] | spec/headers: body-of make make object! [ Accept: "*/*" Accept-Charset: "utf-8" Host: either spec/port-id <> 80 [ rejoin [form spec/host #":" spec/port-id] ] [ form spec/host ] User-Agent: "REBOL" ] spec/headers what exactly is this code doing? |
BrianH 5-Jan-2010 [83x2] | Makes a object containing the standard http headers derived from the template object, also defined in a literal spec. |
Has an extra object of overhead. | |
Graham 5-Jan-2010 [85] | so spec/headers contains the standard template, and it adds these other members to this template? |
BrianH 5-Jan-2010 [86x2] | Yeah, I think so. I shoud check for sure. This is why I am starting woth mezz-ports.r first. |
Something looks reversed, like spec/headers is using the specific headers as a template rather than the reverse. Don't know why yet. | |
Graham 5-Jan-2010 [88x3] | So, it is modifying the original spec/headers by adding these new members to spec/headers ... as a way of modifying the object in situ as it were |
I wonder why he can't do this spec/headers: make spec/headers [ Accept: "*/*" Accept-Charset: "utf-8" Host: either spec/port-id <> 80 [ rejoin [form spec/host #":" spec/port-id] ] [ form spec/host ] User-Agent: "REBOL" ] | |
oh ... headers is a block and not an object! | |
BrianH 5-Jan-2010 [91] | I think that the Accept, Accept-Charset and User-Agent headers are the defaults, and spec/headers are the user-specifiable options. |
Graham 5-Jan-2010 [92] | So he is using make object! to ensure that he has unique members in the created block! |
BrianH 5-Jan-2010 [93] | Actually, an object is created. Then it is converted to a string later. |
Graham 5-Jan-2010 [94] | Yeah .. seems a rather round about way of doing things. |
BrianH 5-Jan-2010 [95x2] | There are a lot of interesting tricks you can do with objects that are much trickier with string-format headers. It's worth it. |
We can look into reducing the overhead though. | |
Graham 5-Jan-2010 [97x4] | In make-http-request there is this result: rejoin [ uppercase form method #" " either file? target [next mold target] [target] " HTTP/1.0" CRLF ] since it is stated that http 1.1 is being supported, we should change this to 1.1 |
yeah ... some function that appends one block of set pairs to another without overwriting the original ... | |
make-http-request says that content is [ any-string! none! ] it then converts this to binary. But if we want to send a binary file using PUT, I think this must mean we need to convert that file to string first ... which seems wrong. | |
we should allow binary! as well ... and change the code to if content [ if string? [ content: to binary! content ] repend result ["Content-Length: " length? content CRLF] ] | |
older newer | first last |