Re: 401 error



On 07/16/2015 07:14 AM, Sam Bull wrote:
I've failed to get any response at all from the GNOME shell list, so I'm
posting this to a couple of other related lists, to see if I can get any
support. My extension has stopped working in GNOME 3.14+ due to a 401
error. Can anybody help with this? Details below.

On Sat, 2015-06-20 at 00:45 +0100, Sam Bull wrote:
On Sat, 2015-06-13 at 10:54 +0100, Sam Bull wrote:
On Mon, 2015-06-01 at 09:53 +0100, Sam Bull wrote:
In GNOME Shell 3.14, on Ubuntu 15.04, my extension is no longer able to
sync to Owncloud due to a 401 error. Is there a change to
Soup.message.new() that causes it to use cookies or something?

No. If you don't manually add a SoupCookieJar feature to the session, it
won't use cookies.

It's impossible to say for sure what's wrong without seeing more
information. Eg, the rest of the code, or a copy of the HTTP request and
response.

        (gnome-shell:1470): libsoup-WARNING **: soup-session.c:887:
        invalid property id 18 for "add-feature-by-type" of type
        'GParamGType' in 'SoupSession'
        (gnome-shell:1470): Gjs-WARNING **: JS ERROR: TypeError:
        httpSession.add_feature_by_type is not a function

With the code:

        const httpSession = new Soup.Session();
        httpSession.add_feature_by_type(Soup.TYPE_AUTH_BASIC);

Yeah, that's a known bug in the gjs bindings. You'd have to do:

  Soup.Session.prototype.add_feature_by_type.call(httpSession,
Soup.TYPE_AUTH_BASIC);

But that's not your problem anyway. Basic auth is enabled by default.
However, I mention this because you could instead do:

  logger = Soup.Logger.new(Soup.LoggerLogLevel.BODY, -1);
  Soup.Session.prototype.add_feature.call(httpSession, logger);

and then it will log the HTTP traffic.

(Note: not actually tested, but I think that's the right JS syntax...)

-- Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]