pottermm / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

User-Agent values setting issue #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build the latest revision in win32
2. Run the application and set User-Agent value like (Mozilla/5.0 (Windows NT 
6.0; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0) in onBeforeResourceLoad of 
RequestHandler class.
3. Open http://www.whatsmyuseragent.com/

What is the expected output? What do you see instead?
The User-Agent value has been set and passed when executing from eclipse IDE 
and the User-Agent persists for all the future requests but, while executing 
the application from command prompt, the User-Agent seems to be set, but the 
request  takes the default value (Mozilla/5.0 (Windows NT 6.1; WOW64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36) as 
User-Agent string.

What version of the product are you using? On what operating system?
JCEF Revision: 100
CEF Binary: 3.1916.1749

Please provide any additional information below.

Values set in onBeforeResourceLoad() method

request.setMethod("GET");
request.setURL(forwardTo);
request.setFirstPartyForCookies(forwardTo);
Map<String, String> headerMap = new HashMap<String,String>();
request.getHeaderMap(headerMap);
log.info("Before removing.. " + headerMap.get("User-Agent") + " -- " + 
headerMap.get("Content-Type") + " -- " + headerMap.get("Origin"));
//headerMap.remove("Content-Type");
//headerMap.remove("Origin");
headerMap.remove("User-Agent");
headerMap.put("Accept-Language", 
"en;q=1.0,fr;q=0.9,de;q=0.8,ja;q=0.7,nl;q=0.6,it;q=0.5,es;q=0.4,zh-Hans;q=0.3,ru
;q=0.2");
headerMap.put("Accept", 
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
headerMap.put("Accept-Encoding", "gzip");
headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:31.0) 
Gecko/20100101 Firefox/31.0");
request.setHeaderMap(headerMap);

Original issue reported on code.google.com by arun.vc....@gmail.com on 8 Sep 2014 at 9:46

GoogleCodeExporter commented 9 years ago
Should be related to the issues

1) 
http://www.magpcss.org/ceforum/viewtopic.php?f=14&t=11598&p=22519&hilit=useragen
t#p22519

2) 
http://www.magpcss.org/ceforum/viewtopic.php?f=14&t=12083&p=22518&hilit=useragen
t#p22518

Original comment by arun.vc....@gmail.com on 10 Sep 2014 at 6:40

GoogleCodeExporter commented 9 years ago
@#1: Those forum posts relate to the global CefSettings.user_agent value and 
the bug is https://code.google.com/p/chromiumembedded/issues/detail?id=1275.

What you're trying to do (set the user agent using a CefRequest in 
onBeforeResourceLoad) is a different issue.

Original comment by magreenb...@gmail.com on 18 Sep 2014 at 4:04

GoogleCodeExporter commented 9 years ago
Marshall,

Could you pls suggest if this will be related which part of the code? (i.e, 
either CEF builds or Java code) so that, I can try and debug for solutions or 
ideas.

Regards,
Arun

Original comment by arun.vc....@gmail.com on 22 Sep 2014 at 1:18

GoogleCodeExporter commented 9 years ago
On checking further, when we run this app as standalone one, we are noticing 
that request.getMethod() returns NULL in onBeforeResourceLoad() method.

Original comment by arun.vc....@gmail.com on 14 Oct 2014 at 6:43

GoogleCodeExporter commented 9 years ago
Hi Marshall,

This issue can be resolved as it's a Native Library accessing issue while we 
pack the libraries and jar files into a compressed jar. Now we have understood 
on how to pass the arguments properly.

Thanks,
Arun

Original comment by arun.vc....@gmail.com on 29 Oct 2014 at 2:09

GoogleCodeExporter commented 9 years ago
@#5: Thanks for the update.

Original comment by magreenb...@gmail.com on 1 Nov 2014 at 5:47