Referer from Phantomjs is different from the url opened by Phantonjs
my code like this:
var page = require('webpage').create();
page.onResourceRequested = function(req) {
console.log('requested: ' + JSON.stringify(req, undefined, 4));
};
page.open("http://s.1688.com/selloffer/offer_search.htm?keywords=%C1%AC%D2%C2%C8%B9&n=y&from=industrySearch&industryFlag=clothing&aaa=201565|201564", function(status) {
if (status !== 'success') {
console.log('FAIL to load the address');
phantom.exit();
}
});
the opened url is
http://s.1688.com/selloffer/offer_search.htm?keywords=%C1%AC%D2%C2%C8%B9&n=y&from=industrySearch&industryFlag=clothing&aaa=201565|201564.
but we can see that all Referers from this page are
http://s.1688.com/selloffer/offer_search.htm?keywords=%C1%AC%D2%C2%C8%B9&n=y&from=industrySearch&industryFlag=clothing&aaa=201565%7C201564
then I checked Chrome browser, it shows that Referer should be
http://s.1688.com/selloffer/offer_search.htm?keywords=%C1%AC%D2%C2%C8%B9&n=y&from=industrySearch&industryFlag=clothing&aaa=201565|201564.
It seems that Phantomjs encode | to %7C, I don't know why, Is it a bug?
This is not a bug; this is a harmless variation between PhantomJS's HTTP library (which comes from Qt) and Chrome's HTTP library (which they wrote themselves). | is not syntactically significant in a URL, therefore server-side code should be prepared to encounter it either %-encoded or not, and should normalize as appropriate.