Bug #2520

addHTTPAuth is broken in duktape

Added by Leonid Protasov almost 6 years ago. Updated almost 6 years ago.

Status:InvalidStart date:01/25/2015
Priority:HighDue date:
Assignee:Andreas Smas% Done:

0%

Category:Ecmascript & Duktape
Target version:4.10
Found in version:4.9.100 Platform:Linux

Description

I'm doing:

        plugin.addHTTPAuth('.*apple.com.*', function(req) {
            req.setHeader('User-Agent', 'QuickTime/7.6.2');
        });

But ST sets ^ ancor and regex won't work

Adding HTTP insepction for pattern ^.*apple.com.*

History

#1 Updated by Andreas Smas almost 6 years ago

  • Status changed from New to Invalid

You need to include "http://"

#2 Updated by Leonid Protasov almost 6 years ago

Andreas Ă–man wrote:

You need to include "http://"

I tried following and none of it works:

http://.*apple.com.*
http:\/\/.*apple.com.*
http:\/\/.*apple\.com.*

Only this works:

http://trailers.apple.com.*

I suppose the problem is ^ ancor.

#3 Updated by Andreas Smas almost 6 years ago

Ok, so it seems that duktape converts the \. into just a dot

So you need to double escape.

.httpInspectorCreate('https://.*\\.apple\\.com/.*', function(req) {
 req.setHeader('User-Agent', 'QuickTime/7.6.2');
});

works for me

#4 Updated by Leonid Protasov almost 6 years ago

Thanks. Worked like magic. Wiki is corrected correspondigly.

Also available in: Atom PDF