Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance URL is not correctly substituted in Mastodon's user agent #2702

Closed
packetbiral opened this issue May 2, 2017 · 3 comments
Closed

Comments

@packetbiral
Copy link
Contributor

Looking through my nginx log, I found this:
"http.rb/2.2.2 (Mastodon/1.3.2; +http://{}/)"

I believe the "{}" there should actually be the instance URL.


  • [*] I searched or browsed the repo’s other issues to ensure this is not a duplicate.
  • [*] This bug happens on a tagged release and not on master (If you're a user, don't worry about this).
@packetbiral
Copy link
Contributor Author

Some additional context, this is the commit that add the user-agent functionality:
23ecc68

@nightpool
Copy link
Member

nightpool commented May 2, 2017

this is because static initializers run before Rails.application.configure, which is unsurprising. user_agent should be a memoized function instead

@nightpool
Copy link
Member

nightpool commented May 2, 2017

here's the code, for reference

module HttpHelper
  USER_AGENT = "#{HTTP::Request::USER_AGENT} (Mastodon/#{Mastodon::Version}; +http://#{Rails.configuration.x.local_domain}/)"

  def http_client(options = {})
    timeout = { write: 10, connect: 10, read: 10 }.merge(options)

    HTTP.headers(user_agent: USER_AGENT)
        .timeout(:per_operation, timeout)
        .follow
  end
end

Gargron added a commit that referenced this issue May 4, 2017
…ad of cron

Fix an issue where / in domain would raise exception in TagManager#normalize_domain

PuSH subscriptions refresh done in a round-robin way to avoid hammering a single
server's hub in sequence. Correct handling of failures/retries through Sidekiq (see
also #2613). Optimize Account#with_followers scope. Also, since subscriptions
are now delegated to Sidekiq jobs, an uncaught exception will not stop the entire
refreshing operation halfway through

Fix #2702 - Correct user agent header on outgoing http requests
Gargron added a commit that referenced this issue May 5, 2017
* Fix #2473 - Use sidekiq scheduler to refresh PuSH subscriptions instead of cron

Fix an issue where / in domain would raise exception in TagManager#normalize_domain

PuSH subscriptions refresh done in a round-robin way to avoid hammering a single
server's hub in sequence. Correct handling of failures/retries through Sidekiq (see
also #2613). Optimize Account#with_followers scope. Also, since subscriptions
are now delegated to Sidekiq jobs, an uncaught exception will not stop the entire
refreshing operation halfway through

Fix #2702 - Correct user agent header on outgoing http requests

* Add test for SubscribeService

* Extract #expiring_accounts into method

* Make mastodon:push:refresh no-op

* Queues are now defined in sidekiq.yml

* Queues are now in sidekiq.yml
Gargron added a commit that referenced this issue May 5, 2017
* Fix #2473 - Use sidekiq scheduler to refresh PuSH subscriptions instead of cron

Fix an issue where / in domain would raise exception in TagManager#normalize_domain

PuSH subscriptions refresh done in a round-robin way to avoid hammering a single
server's hub in sequence. Correct handling of failures/retries through Sidekiq (see
also #2613). Optimize Account#with_followers scope. Also, since subscriptions
are now delegated to Sidekiq jobs, an uncaught exception will not stop the entire
refreshing operation halfway through

Fix #2702 - Correct user agent header on outgoing http requests

* Add test for SubscribeService

* Extract #expiring_accounts into method

* Make mastodon:push:refresh no-op

* Queues are now defined in sidekiq.yml

* Queues are now in sidekiq.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants