SoupCookieJar: preserve 'Cookie' header in SoupMessage
Today SoupCookieJar will unconditionally remove 'Cookie' header from SoupMessage if it's present and replace it with one from the jar (if any).
There is a use case in browser automation where the automation client intercepts page request before it's been sent and modifies its headers, in particular provides custom 'Cookie' header. It doesn't work in WebKit today because SoupeCookieJar
will always delete existing 'Cookie' header from SoupMessage. One possible solution in this case could be to disable cookie jar for this particular message (via soup_message_disable_feature(msg, SOUP_TYPE_COOKIE_JAR);
) but in that case Set-Cookie
handler wouldn't be invoked either while it is expected to work as usual.
It'd be nice if we could configure the behavior by e.g. setting a flag similar to one of these which would change the behavior, something like SOUP_MESSAGE_PRESERVE_COOKIE_HEADER
. If this makes sense I can prepare a PR.