You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, June 9th 2005, 11:43pm

set site specific Referer, like UserAgent

Is it possible to set a site specific Referer, the same way as site specific UserAgents are set? I already saw that the UserAgents are stored in kio_httprc. I would like to write a little patch that reads Referers from this file (kio_httprc) the same way as it reads the UserAgents:

Something like:
[somesite.com]
UserAgent=Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Referer=http://www.somereferer.com

The problem is that I can't seem to find in which sourcefile the UserAgent from kio_httprc is read and then set for the httprequest. There are so many possible places (konqueror, libkonq, kio_http, kcontrol, ...).

Does anyone know where this file is?

And does anyone with a lot of knowledge about the workings of Konqueror/kio_http know if what I want can be done as easily as I think?

Thanks in advance for your interest!

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Friday, June 10th 2005, 2:20pm

Very likely kio_http as it handles the HTTP protocol.

Cheers,
_
Qt/KDE Developer
Debian User

3

Friday, July 1st 2005, 10:38pm

Sorry it took me so long to reply, but understanding how a webpage gets fetched in KDE takes a long time (and I'm still not done).

As far as I can see, nor the user-agent, nor the referer get set at the kio_http code, because kio_http just does a metaData("referrer") and metaData("UserAgent")

What I can't seem to find is where the UserAgent metaData gets set. But that's not why I decided to write again. I'm writing this because I found out that setting a custom referer ALREADY WORKS!

...But there is a catch

If you edit ~/.kde/share/config/kio_httprc

adding a section for a site with a custom referer (I tested with my own server):

[127.0.0.1]
referrer=http://www.fake.com/

it doesn't work, BUT if you change the User-Agent in Konqueror it works the first time you reload the page. After that, the User-Agent remains changed, but the referer goes back to the real one.

This makes me think it's even more trivial than I already thought, but I still don't understand how the whole mechanism works, or this behaviour wouldn't have surprised me so much.

Is there anyone with enough knowledge about Konqueror's page fetching mechanism to explain what's really happening here. The more KDE code I read, the more lost I get...

Thanks again!

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Saturday, July 2nd 2005, 1:47pm

Ask on the mailingslist kfm-devel (Konqueror/KHTML developer mailinglist)

Cheers,
_
Qt/KDE Developer
Debian User