Example code |
URL-encoding:
>> url: http://test/abc/#def/ghi
== http://test/abc/#def/ghi
If I do it manually, the "%" gets encoded, though:
>> replace url "#" "%23"
== http://test/abc/%2523def/ghi
"@" and ":"
>> read http://localhost:8008/@xxx:localhost
** Access error: cannot connect: tcp://xxx:80 reason: 0
** Where: open open unless sync-op either read
** Near: open conn port
"#" as part of the url:
>> write http://localhost:8008/_matrix/client/api/v1/join/#test2:localhost?access_token=shortened ""
** Access error: protocol error: "Server error: HTTP/1.0 403 Forbidden"
Testing the same using curl:
$ curl -XPOST "http://localhost:8008/_matrix/client/api/v1/join/#test2:localhost?access_token=shortened" -d ""
{"errcode":"M_FORBIDDEN","error":"Missing access token."}⏎
My guess is that the url is cut at the "#", because of it special meaning in urls. So let's try to url-encode the "#":
>> write http://localhost:8008/_matrix/client/api/v1/join/%23test2:localhost?access_token=shortened ""
** Access error: protocol error: "Server error: HTTP/1.0 403 Forbidden"
Testing again with curl:
$ curl -XPOST "http://localhost:8008/_matrix/client/api/v1/join/%23test2:localhost?access_token=shortened" -d ""
{"room_id":"!mLfKqJqpsJduuNgzDy:localhost"}⏎
So the problem for Rebol seems to be that "#" is not url-encoded, but if I try to url-encode it, the "%" sign gets encoded, so the url is broken again. (As mentioned in the beginning).
|