Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

user-agent can not contains chinese #1144

Closed
laibinzhi opened this issue Sep 19, 2018 · 11 comments
Closed

user-agent can not contains chinese #1144

laibinzhi opened this issue Sep 19, 2018 · 11 comments

Comments

@laibinzhi
Copy link

When I configure PLATFORM_NAME as Chinese in the config.yaml file, I get an error.because
I find the request header in okhttp cannot contain Chinese.
Edx has a big market in China.
I hope to solve it ASAP.

@miankhalid
Copy link
Contributor

Can you share an example config and the exact error that you see?

@laibinzhi
Copy link
Author

@miankhalid
09-19 15:44:39.334 9071-9104/org.edx.mobile.elitemba E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: org.edx.mobile.elitemba, PID: 9071
java.lang.IllegalArgumentException: Unexpected char 0x6d4b at 60 in User-Agent value: Dalvik/2.1.0 (Linux; U; Android 6.0.1; MI 4LTE MIUI/8.4.28) 测试平台/org.edx.mobile.elitemba/2.15.1
at okhttp3.Headers$Builder.checkNameAndValue(Headers.java:283)
at okhttp3.Headers$Builder.set(Headers.java:263)
at okhttp3.Request$Builder.header(Request.java:165)
at org.edx.mobile.http.interceptor.UserAgentInterceptor.intercept(UserAgentInterceptor.java:22)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at org.edx.mobile.http.interceptor.JsonMergePatchInterceptor.intercept(JsonMergePatchInterceptor.java:30)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

@laibinzhi
Copy link
Author

@miankhalid I configured a Chinese in PLATFORM_NAME and I got an error. Change to English, it is normal

@laibinzhi
Copy link
Author

@miankhalid square/okhttp#2016 this issues is closed。I don't know if okhttp solves this problem now.

@miankhalid
Copy link
Contributor

This needs some research. I am a little busy with some of my own work.
Would you be kind enough to give this a go, come up with a solution and push up-stream for us to review?

@miankhalid
Copy link
Contributor

Closing due to no reply from the contributor.

@laibinzhi
Copy link
Author

@miankhalid I am glad that you still remember this question. I just tested this PR and found that there is no exception and it works fine. But I don't really recommend this solution. The following is the modified User-Agent: Dalvik/2.1. 0 (Linux; U; Android 8.1.0; Nexus 6 Build/OPM2.171026.006.H1) /cn.test.android/ 2.16.3. The following is the User-Agent before modification: Dalvik/2.1.0 (Linux; U; Android 8.1.0; Nexus 6 Build/OPM2.171026.006.H1)测试程序/cn.test.android/ 2.16.3. Found that the former is missing a part (测试程序). Does this part of the less have no effect? I remember that when controlling the version upgrade, you need to configure some parameters, check the UserAgent and regular expressions.Please refer to the following two links and the specified number of rows:
https://github.com/edx/edx- platform/blob/ a439d5164c07e4695181b15244e8e5 c7681421c4/lms/djangoapps/ mobile_api/mobile_platform.py# L63
https://github.com/edx/edx- platform/blob/a439d5164c/lms/ envs/common.py#L3252

@miankhalid
Copy link
Contributor

@laibinzhi can you add this comment on the PR instead of here? that way the originator of the PR will also have visibility of it and have a chance of chiming in on your reservations. Thanks!

@laibinzhi
Copy link
Author

laibinzhi commented Jan 23, 2019 via email

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

No branches or pull requests

2 participants