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

World: r3wp

[!REBOL2 Releases] Discuss 2.x releases

Graham
2-Sep-2010
[2024]
All urls are deconstructed into an object
BrianH
2-Sep-2010
[2025x3]
Right. But the problem I am trying to fix is this:
>> http://user%40rebol.com:[blah-:-www-:-rebol-:-com]/
== http://[user-:-rebol-:-com]:[blah-:-www-:-rebol-:-com]/
Somewhere in the middle of that process, DECODE-URL is called. What 
is called after that to reassemble the result into a url! value?
The dehex in that process is the one that we need to get rid of.
Graham
2-Sep-2010
[2028]
I suspect we don't have the source to that...
Maxim
2-Sep-2010
[2029]
look in the URL-parser context within the prot-utils.r file.

that is where the url decoding occurs.
Graham
2-Sep-2010
[2030]
There's no 'dehex there
Maxim
2-Sep-2010
[2031]
but I remember having the same issue a while back and traced it to 
the actual datatype always handling the hex values.
Graham
2-Sep-2010
[2032x2]
I don't think it matters
yes, Max ..
Maxim
2-Sep-2010
[2034]
just using the to-url created the same headaches... IIRC
Graham
2-Sep-2010
[2035]
Brian's issue is not a problem
BrianH
2-Sep-2010
[2036]
That is exactly where it matters. That is the whole problem.
Graham
2-Sep-2010
[2037]
We can fix it without worrying about that part
BrianH
2-Sep-2010
[2038]
That part is the only part that needs fixing.
Maxim
2-Sep-2010
[2039x2]
brian .. I agree.. the hexing should stay in the url datatype until 
the actual network scheme requires to handle it.  % characters are 
valid url so they should not get "fixed"
%XX  that is.
Graham
2-Sep-2010
[2041]
But you can't fix it because it's the way Rebol evaluates datatypes 
.. only Carl can fix that.
Maxim
2-Sep-2010
[2042]
exactly.
BrianH
2-Sep-2010
[2043]
Since when is that a constraint?
Graham
2-Sep-2010
[2044]
12 years I think now
BrianH
2-Sep-2010
[2045]
Problems that only Carl can fix still need fixing.
Maxim
2-Sep-2010
[2046x3]
so its a limitation in the URL datatype... akin to agressive error 
evaluation.
so in REBOL speak, url dehexing should, be "relaxed" :-)
in my app, I ended up doing all URL manipulation in strings, and 
then just converting to url at the time of network call
BrianH
2-Sep-2010
[2049]
Or at least put off until it is appropriate to do.
Maxim
2-Sep-2010
[2050x2]
IMHO the datatype can't know when. only the schemes and url processors 
know "when" is appropriate.
the problem is when we are programatically managing uri.  the datatype 
dehexing really gets in the way.
Graham
2-Sep-2010
[2052]
>> http://user%40rebol.com:[blah-:-www-:-rebol-:-com]/
== http://[user-:-rebol-:-com]:[blah-:-www-:-rebol-:-com]/
>> a: to-url "http://user%40rebol.com:[blah-:-www-:-rebol-:-com]"
== http://user%40rebol.com:[blah-:-www-:-rebol-:-com]
>> a
== http://user%40rebol.com:[blah-:-www-:-rebol-:-com]
BrianH
2-Sep-2010
[2053x2]
It's really simple: The url! datatype should do no dehexing itself. 
The file! datatype can dehex, but not url!. Dehexing is only safe 
after decoding.
Graham, thanks for narrowing it down.
Maxim
2-Sep-2010
[2055x2]
just tried a read, and when the second form of graham's test (using 
to-url on a string) the url parser doesn't dehex... so the username 
will be invalid.
but I guess the server is responsible for dehexing in that case.
BrianH
2-Sep-2010
[2057x2]
Um, no. The HTTP standard for basic authentication doesn't hex-encode 
the user or password fields. The browser (or in our case, http scheme) 
does.
Only the path is hex-encoded when passed to the server.
Maxim
2-Sep-2010
[2059x2]
ok so then the dehexing should be added in the url-parser and string 
notation used for @ containing passwords.  

just like we use string notation for files containing spaces.
this could a workaround until Carl stops dehexing in the loading 
phase.
BrianH
2-Sep-2010
[2061]
Still haven't traced that.
Maxim
2-Sep-2010
[2062]
>> c: load "http://user%40rebol.com:[blah-:-www-:-rebol-:-com]"
== http://[user-:-rebol-:-com]:[blah-:-www-:-rebol-:-com]
BrianH
2-Sep-2010
[2063]
No, I mean I haven't traced it. LOAD calls other functions, maybe 
even in R2.
Chris
2-Sep-2010
[2064]
The 'solution' is: read [scheme: 'http user: "[user-:-rebol-:-com]" pass: 
.........]

: )
Maxim
2-Sep-2010
[2065]
but that's not a uri  ;-)   the point of the url datatype is that 
we shoudn't need to use "specifications" but uri paths.
Chris
2-Sep-2010
[2066]
I know, I know.  I've just used it many times : )
Gabriele
3-Sep-2010
[2067]
The standard is very explicit on how encoding should work. Reserver 
characters must never be decoded BEFORE you split the URL into its 
parts (which can only be done if you understand the scheme). Any 
other character may be decoded just like REBOL does.


So, it's not that URL! should never decode, it's that it should never 
decode the reserved characters. Then, the handler for each protocol 
needs to decode the parts separately after splitting. Since the protocols 
we use in REBOL all have the same format basically, you can use a 
single function to handle all of them, eg. like my parse-url.
Gregg
3-Sep-2010
[2068]
Excellent summary Gabriele. Thanks for posting that. It makes the 
problem and solution very clear.
Tomc
9-Sep-2010
[2069]
Carl wrote:   I'm wrapping up R3 A107... so if we want to do some 
test builds for 2.7.8 on this, let me know.
Kaj
9-Sep-2010
[2070]
The question is where. There was a similar call in R3 Chat at the 
beginning of the year, but no response there
Tomc
9-Sep-2010
[2071]
Personaly I think putting out some test builds is always a good thing, 
 and the prudent thing to to is to make them available for the most 
popular platforms, best chance of someone doing something that results 
in useful feed back. unfortunatly as a unpopular platform user that 
means I am out.
Graham
11-Sep-2010
[2072x2]
I find the loss of data on reading a http/s page annoying.   ie, 
losing the http headers
I've inserted a save-header function here


   port/locals/headers: headers: save-header Parse-Header HTTP-Header 
   headers

but the question now is, where is the best place to store this?