Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is impossible to read/write url! s with some special characters #2207

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 1 comment
Closed

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: IngoHohmann

URL!s with "#" "@" ":" can not be read, because they are not url-encoded / interpreted incorrectly.

Furthermore, when trying to url-encode it by hand, the "%" will be url-encoded again in the url, rendering it incorrect again.

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).


Imported from: CureCode [ Version: r3 master Type: Bug Platform: All Category: Parse Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#2207

Comments:


Rebolbot added Type.bug and Status.important on Jan 12, 2016


Ladislav commented on Jan 22, 2016:

I think that this is #2012 reformulated.


IngoHohmann mentioned this issue on Feb 5, 2020:
Semicolons should be legal in URL


@Oldes
Copy link
Owner

Oldes commented Apr 14, 2022

Now it should be ok:

>> decode-url http://localhost:8008/_matrix/client/api/v1/join/#test2:localhost?access_token=shortened
== [scheme: 'http host: "localhost" port: 8008 path: %/_matrix/client/api/v1/join/ fragment: "test2:localhost?access_token=shortened"]

>> decode-url http://localhost:8008/@xxx:localhost
== [scheme: 'http host: "localhost" port: 8008 path: %/ target: %@xxx:localhost]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants