Vector
Vector

Reputation: 11

how to get request header and response header by webkitGTK

I want to get the request header before the webkitGTK begin to send request and load the page. Then I want to get the response headers. However, I don't find such API in webkitGTK.

Upvotes: 0

Views: 1058

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14607

In Webkit1 the signal you want is WebKitWebView::resource-request-starting: The request argument contains a WebKitNetworkRequest which has a SoupMessage which will allow you to modify the request headers. The same signal has resource argument which has a response-received which in turn will contain a WebKitNetworkResponse. The SoupMessage of that response will have the response headers you want.

In Webkit2GTK the WebKitWebView::resource-load-started should be useful for at least monitoring: request and resource arguments work almost like the WebKit1 versions. The bit that I'm not 100% sure about is whether you can modify the request headers here -- or if you have to implement a WebExtension and use the WebKitWebPage::send-request signal.

Upvotes: 1

Related Questions