r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Graham
22-Sep-2008
[10945x7]
read/custom URL compose/deep [ PUT %file.png [ Cookie: (cookie) ]]


will use the http put method to upload a binary file and sets the 
cookie
So, this will work with large files, it should be changed so that 
it does a skip/binary and inserts the file in chunks.
If the server returns an error such as 400 bad request, Rebol appears 
to discard any messages that the server sends back with this .... 
and just throws an error.
Wouldn't it be better if we had access to the data sent to us without 
doing an 'open instead of a 'read ?
This is pretty cool .. I just uploaded a 14Mb file using PUT ( though 
I had to increase the http timeout period )
Seems odd to me that the port will timeout even though it "knows" 
it is writing data to the port.
Here's the protocol with my changes ..

http://rebol.wik.is/Protocols/Http
Louis
23-Sep-2008
[10952x2]
file: replace/all file {оп} {}


Why can't rebol replace that string in the file I'm processing?  
It will replace it in a string entered at the command console, but 
not in my file.
file: read %file.txt
Henrik
23-Sep-2008
[10954]
it's better to do it on a binary representation of the string, using 
'as-binary. the chars you enter in console may not be of the same 
charset as those you have saved the file in.
Louis
23-Sep-2008
[10955x3]
Like this?

file: replace/all file as-binary {оп} {}
Henrick, from what you say, I think I see what is happened. I'm copying 
the string from a utf-8 encoded file to an assci encoded file. The 
copy converts the string to different characters. But how do I get 
around this?
is happened = is happening
Henrik
23-Sep-2008
[10958x3]
you must work solely from the encoding in the file. intermixing input 
from the console will ruin that. I will post an example in a minute.
or easier for me to explain: you must search for the hex values in 
the file. work only in binary.
what I would do is get the offending chars from your file in a text 
editor and paste them in a separate file and save it in the same 
encoding as the original file. then read/binary it with rebol, and 
you can see the hex values directly.
Gabriele
23-Sep-2008
[10961]
Graham, in R3's http you can use any method you want, with any headers 
you want and any content you want. Was this your question? (I do 
still need to add transparent cookie support. but that's a few minutes 
work, so it'll be there for release.)
Louis
23-Sep-2008
[10962]
Henrik, that worked. Many thanks!
Henrik
23-Sep-2008
[10963]
congrats :-)
Graham
23-Sep-2008
[10964x4]
Gabriele ... I probably did ask that question and it's good to know 
the answer is affirmative.
But since we are stuck without R3 at present, I'm needing to patch 
the R2 prot-http so that we can use all the headers.
methods.
What's the situation with timeouts in R3?
Gabriele
24-Sep-2008
[10968]
not too good yet. but, i know Carl has that internally, it's just 
not exposed.
Will
24-Sep-2008
[10969]
has the forward recursion problem from http been fixed in R3 ?
BrianH
24-Sep-2008
[10970]
The HTTP handler and the entire port model is completely different 
in R3, so they have almost no code in common. R3 will have an entirely 
new set of bugs to worry about :)
Graham
24-Sep-2008
[10971]
that's very reassuring Brian.
BrianH
24-Sep-2008
[10972x2]
Here's something to reassure you: Gabriele wrote the HTTP scheme 
for R3.
Don't worry about the port model changes - the new model is much 
better.
Graham
24-Sep-2008
[10974x3]
Yes, I saw it .. didn't understand a thing as usual!
What I was wondering though was, why should a protocol timeout even 
though it is still actively communicating ie. sending data to a port?
and presumably receiving acks back
BrianH
24-Sep-2008
[10977x3]
Don't presume, check. If you don't get the ack in time, timeout.
I haven't written a network protocol in either port model yet (just 
studied them), so I can't say why you are getting timeouts in this 
particular case though.
Later...
Robert
4-Oct-2008
[10980]
load/all: Does this skip everything until a REBOL header is found?
Chris
4-Oct-2008
[10981]
No -- /all assumes all text is data and that the header, if present, 
is two more values.
Gregg
4-Oct-2008
[10982]
It can be a bit tricky. LOAD ignores all *lines* before the one where 
"^/REBOL []" is found.


Sunanda is probably the preeminent expoert here, as he dealt with 
all kinds of loading issues for REBOL.org.
Chris
4-Oct-2008
[10983]
That's 'load though, not 'load/all
Sunanda
4-Oct-2008
[10984]
I'm not the expert (thanks all the same, Gregg) but I did start a 
ML thread in which the real experts looked at key aspects of load 
and 'load/all for scripts:
http://www.rebol.org/ml-display-thread.r?m=rmlTRFQ
Gregg
4-Oct-2008
[10985]
Correct.
Terry
4-Oct-2008
[10986]
what's the best way to stich some strings in a block together? 
ie: "this is a test here"

where I parse this, set the first word to 'one, set the second to 
'two and everything after that to 'three ?
Tomc
4-Oct-2008
[10987x3]
one un-tried way
parse/all str[ 
  (blk: copy []} 
  2 [copy token to " " (insert tail blk token)] 
  copy token to end     (insert tail blk token 
  -- do something with blk
  )
]
(blk: copy [])
Terry
4-Oct-2008
[10990]
Hmm.. my brain is too lazy...  I went like this.. 
ie: "this is a test here" 
a: parse ie none
one: first a
two: second a
three: reform skip a 2
sqlab
5-Oct-2008
[10991]
parse/all ie [copy one to " "  skip  copy two to " " skip copy three 
to end]
Chris
5-Oct-2008
[10992]
; Terry, with 'take (2.7.6+?) it can be shorter still:

three: parse ie none
one: take three
two: take three
three: reform three
Terry
5-Oct-2008
[10993x2]
cool.
curious now as to which way is faster?