Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the user agent is sent as "Apache-HttpClient/UNAVAILABLE (java 1.4)”

A sample mobile application sends POST requests to a HTTP server which we use to process information sent from the mobile application. We parse HTTP headers and the User-Agent header is always seen as "Apache-HttpClient" on all Android devices with different OSes.

If i perform any action from app in android device, it returns the user agent as Apache-HttpClient/UNAVAILABLE (java 1.4)

what's the problem? It doesn't provide me a User Agent string which contains information like OS information and other details.. Has anyone seen similar behavior before?

like image 985
SONU Avatar asked Sep 19 '14 07:09

SONU


1 Answers

Apache-HttpClient/UNAVAILABLE (java 1.4) Is the default User Agent string for the Apache client that your app is using, it is not an error in itself.

This client know's very little about the system that it is running on, which is for the best - it's just a simple one-size-fits-all method for an Android device (which could be a phone, a tablet, a TV or even a car!) to make http requests to the outside world.

User Agent strings are a way for User Agents (read "browsers") to identify themselves.

In the case of an Android App, your App is the browser, so the User agent string is for you to define within your app.

See: Android Generic User Agent (UA)

If you want to send information about the device then you need to collect that information with your app and then send it. Though, if you are collecting that data then you might as well put it in the body of the request rather than HTTP headers anyway.

like image 54
Jason Elkin Avatar answered Sep 20 '22 12:09

Jason Elkin