Information About Resubmitting Requests on Android

Asked 2 years ago, Updated 2 years ago, 38 views

In the web service for smartphones, access from Android may result in continuous GET. Features include:

  • The second request has no referrals
  • The second request will come in a few seconds.
  • The second request was made by the user agent Dalvik
  • Several Terminals

This problem has caused some features to behave like bugs.
What should I do?

I'd appreciate it if there was a way to read the javascript and not send it.   If not, will the server monitor it?The server-side environment is php+Zend.

android

2022-09-30 17:42

3 Answers

I think it's a problem on the Android device (specific model) side).
The web browser or Android OS seems to be resending it at its own discretion.

I haven't checked the phenomenon at hand, so I haven't been able to consider it, but it will be difficult for JavaScript to control it.
The server needs to monitor, ignore, and take exception actions.

The behavior of Android side is as follows (I don't know how to handle it on the server side).Was the UserAgent in your second request similar to the following?

"Dalvik/1.6.0 (Linux;U; Android 4.2.2; C2004 Build/15.2.A.2.5)"

This is the UserAgent for HttpURLConnection on Android, which is different from the UA for web browsers.
Here's how to check on the Android app:

System.getProperty("http.agent");

Similar symptoms were reported in StackOverflow's Browser sending "Dalvik" as user agent.

The first request was made from an Android browser and
For some reason, a request using the Android operating system HttpURLConnection has been resend.

The UserAgent is different for each Web browser (WebView), HttpURLConnection, and HttpClient.Typically, if you are using a browser, the browser UA will be included.However, since Android is customized for each model, I assume that some of the specific problems are abnormal/exception handling? cases where the question behavior occurs


2022-09-30 17:42

It's not Android, but I had a similar problem when I released a web app for Windows before.Security software was the cause.

The security software had a mechanism to check if the site you accessed was a fraudulent site.When a user issues a GET request in a browser, the security software detects it, issues a separate GET request for the same URL, and mechanically checks the contents of the site.

HTTP-wise, the system is based on the assumption that GET requests are 等, but it is not a very pleasant method for developers, such as affecting access counters.

I don't know much about Android security software, but is there any possibility that such software has been installed?

In the comment of Stack Overflow, where mhidaka is introduced, there is a person who says that if McAfee antivirus is disabled, it will no longer be sent.

Also, the security software I encountered before was to send the URL of the site that the user accessed to the company's server and get a GET request from the server, so the source IP address was different, but depending on the security software, some programs themselves might access it.

Even if the problem is not caused by security software, there is a good chance that such a problem will appear in the future, so basically, I think it would be good to create a server so that there is no problem with multiple GET requests.


2022-09-30 17:42

without android 4.2.2 SourceCode

./frameworks/base/core/java/com/android/internal/os/RuntimeInit.java

private static String getDefaultUserAgent(){

This private function will form a useragent and set to "http.agent"

./libcore/luni/src/main/java/libcore/net/http/HttpEngine.java
HttpEngine will use it.


2022-09-30 17:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.