Method: Mechanize::HTTP::Agent#request_referer
- Defined in:
- lib/mechanize/http/agent.rb
permalink #request_referer(request, uri, referer) ⇒ Object
Sets a Referer header. Fragment part is removed as demanded by RFC 2616 14.36, and user information part is removed just like major browsers do.
665 666 667 668 669 670 671 672 673 674 |
# File 'lib/mechanize/http/agent.rb', line 665 def request_referer request, uri, referer return unless referer return if 'https'.casecmp(referer.scheme) == 0 and 'https'.casecmp(uri.scheme) != 0 if referer.fragment || referer.user || referer.password referer = referer.dup referer.fragment = referer.user = referer.password = nil end request['Referer'] = referer end |