- Home /
List of HTTP User-Agent's in Unity for various platforms?
Hello again :)
I'm writing here server(java) and client(unity) for my current project, and one of the security tasks is to skip any request that came not from our client.
One of the things we check in first place is HTTP User-Agent value. But unfortunatly WWWForm doesnt allow to set User-Agent and in Unity Script Refference it is says "Read-Only".
Thats fine with us not being able to modifay "User-Agent" manually as Unity set its own User-Agent. for example when I send request from (Win) Unity Editor, the agent is:
"UnityPlayer/4.3.0f4 (http://unity3d.com)"
but the problem is that I cant find anywhere list of all avaliable headers or even mentioning of how those agents are changed depending on the platform.
Would anyone be able to list common agents for:
Web (Win/OSx)
iOS
Android
as I dont have all equipment to build project test it, and actually project itself is far away from it firs test build.
Thank you in advance :)
Answer by Briksins · Jan 05, 2014 at 09:28 PM
Ehhh my bad, I find a way to overwrite headers and User-Agent.
private IEnumerator CoroutineWebRequest(string post)
{
// WWWForm POSTform = new WWWForm();
// POSTform.AddField("data", post);
Hashtable headers = new Hashtable();
headers.Add("User-Agent", userAgent);
string data = "data=" + post;
WWW www = new WWW(finalUrl, Encoding.UTF8.GetBytes(data), headers);
* * # Skipped # * *
As you see you dont need to use WWWForm, you can just convert your post data string to bytes and create hashtable with headers you need
in WWW class it is 4th method:
WWW(string url, byte[] postData, Hashtable headers);
Sorry for creating taht question without doing proper research! but hope it will help someone silly like me in the future :)
Can you please explain more for getting uesr-Agent id.when i use above code i am getting more errors.
Your answer
Follow this Question
Related Questions
how to Post link ( Ruby Script) through unity3d ? 1 Answer
iOS using the client as the server 0 Answers
Help with multiplayer connection 0 Answers
Network how to send data/activate function 1 Answer
Server and Network no communication 1 Answer