Jump to content


Photo

No user-agent on variable requests


2 replies to this topic

#1 shawn

shawn
  • Moderators
  • 791 posts

Posted 14 February 2017 - 06:38 AM

I'm seeing strange UA behavior in Ketarin 1.8.7. I haven't tested this thoroughly, but in my experiments I'm seeing a couple bugs.

 

First, I'd love for the global default user-agent to be alterable. Not just the UA for specific apps, but for the entire installation all at once.

 

Now for the bugs:

 

I assume that the user-agent will be included with all requests, but that's not actually the case. At least during development in the Variables editor, URL requests are sent with an empty UA. Since this is a sure-fire sign of unwelcome traffic, some servers (including my own) block the request with a 403 forbidden. Including the UA with these requests is important.

 

Now, the default UA is *not* included in those instances. But if you set a custom UA in the Advanced settings tab that UA will be used immediately on Variables URL requests.

 

The workaround is to manually assign a custom UA for each app that has problems due to UA filtering.

 

Expected behavior is to use the global UA for all requests, especially those from the Variables feature, except where it's superseded by the app-specific "User agent" option.



#2 tsoutsas

tsoutsas
  • Members
  • 21 posts

Posted 15 February 2017 - 12:02 AM

Mileage may vary, but here's a "workaround" for you.  I say "workaround" because, while the method I'm sharing successfully sets an application profile's user agent on update, finding one of the few applicable ones in my list to test is like finding a needle in a haystack.

 

Making the details verbose for anyone who hasn't worked with these settings.

 

Create a Global Variable:

File -> Settings -> Global variables

 

Name = user_agent

Value = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3007.0 Safari/537.36

 

Create a Global Command:

File -> Settings -> Commands

Edit command for event = Before updating an application

Command = PowerShell script

$app."UserAgent" = $globalvars."user_agent".CachedContent


#3 shawn

shawn
  • Moderators
  • 791 posts

Posted 17 February 2017 - 08:39 AM

Thank you. Warning to anyone reading this and trying the above code: if you're relying upon specific UA's for different apps, this will cause problems for them.

 

A safer workaround is to select all items in the list, copy, paste into notepad, find/replace "<UserAgent />" with "<UserAgent>{user_agent}</UserAgent>", select all, copy & paste it back into Ketarin. This method will only replace the UA if a custom one is not set...but...

 

Workarounds are easy (at least for creating a new general UA), but it really needs to be fixed in the release. The no-UA behavior for new apps is a serious defect as far as I'm concerned. It could very likely get you banned from a server when you are creating a new app profile because you're not aware that it's sending a null header.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users