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

By QRCode scanning, new created profile's name was truncated with only the first part left. #1449

Closed
kimw opened this issue Nov 11, 2017 · 6 comments

Comments

@kimw
Copy link

kimw commented Nov 11, 2017

Environment

  • Android version: 6 & 7
  • Device: Samsung S6 edge, S8/+
  • Shadowsocks version: 4.2.5

What did you do?

Try to add profile, see below, by scanning QR.

  1. profile details
{
  "remarks":       "part1 & part2",
  "server":        "127.0.0.1",
  "server_port":   8388,
  "local_address": "::",
  "local_port":    1080,
  "password":      "UvjXG_4gcedRbDyBxTM82g==",
  "method":        "rc4-md5"
}
  1. URI translated from profile upper
  1. QR codes translated from URI upper
  • QR code 1

    screenshot from 2017-11-11 18 15 52

  • QR code 2

    screenshot from 2017-11-11 18 16 09


Whichever the qrcode I scan, the shadowsocks-android only create a profile with name part1. The & part2 is always truncated.

I've tried the qr codes with ZXing teams' Barcode Scanner from Google Play, it works fine.

@madeye
Copy link
Contributor

madeye commented Nov 11, 2017

I don't think white space is legal in a URI.

@kimw
Copy link
Author

kimw commented Nov 11, 2017

Yes, you're right. White spaces is not legal in URI, but legal in profile name.

SIP002 purposed a new URL schema, following RFC3986:

SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" query ] [ "#" fragment ]
userinfo = websafe-base64-encode-utf8(method  ":" password)

Currently, the fragment is separated by plus +, like Dummy+profile+name. But it's really weired for a profile name, right?

The last / should be appended if query or fragment is present. Example: ss://[email protected]:8888/?plugin=url-encoded-plugin-argument-value&unsupported-arguments=should-be-ignored#Dummy+profile+name. This kind of URIs can be parsed by standard libraries provided by most languages.

So, how's about encode the fragment part into base64 too? Or ... SIP002 improve is needed?

See, SIP002.

@kimw
Copy link
Author

kimw commented Nov 11, 2017

Or, we just choose to support this kind of illegal URI?

@kimw
Copy link
Author

kimw commented Nov 11, 2017

Or, maybe we can define the plus mark as a translated-white-space?

I mean, the white spaces are translated into + in URI. And then, translate back into white space by shadowsocks-android.

@Mygod
Copy link
Contributor

Mygod commented Nov 12, 2017

Use standard URL encoding schemes for special characters.

@Mygod Mygod closed this as completed Nov 12, 2017
@madeye
Copy link
Contributor

madeye commented Nov 13, 2017

More specifically, it'd be %20.

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

No branches or pull requests

3 participants