httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

Option to disable warnings

Open pinpox opened this issue 10 years ago • 7 comments

Hello,

Im getting this warning over and over again:

Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.

I'm looking for a way to fix it, but cant find anything. How do I upgrade or disable thje warnings?

Cheers, binaryplease

pinpox avatar May 04 '15 19:05 pinpox

Hi,

I'm running into the same warning. Unfortunately for me httpclient is setting and getting the cookies using a cookie store and I cannot simply call Cookie#dot_domain as suggested:

cookie_file = Tempfile.new('cookie_jar.txt')
clnt = HTTPClient.new
clnt.set_cookie_store(cookie_file)
clnt.get(URL1)

clnt.post(URL2) # cookie use throws warning 'Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.'

I would say it's preferrable to set a flag in the library to allow the client to use Cookie#dot_domain under the hood:

client.allow_dot_domain_cookie = true

Bob

ghost avatar Jun 03 '15 14:06 ghost

I have similar problem. I need to allow dot_domain but I don't know how.

pdostal avatar Aug 11 '15 22:08 pdostal

:-1: this is annoying.

Using a Faraday::Adapter::HttpClient that does nothing to configure cookie management in httpclient, i.e. https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/httpclient.rb

So this warning is a message for httpclient by httpclient? Why not just fix it in httpclient? The culprit line is at https://github.com/nahi/httpclient/blob/master/lib/httpclient/cookie.rb#L197

Please wrap it to use @@warned so it can be toggled off, see

  • https://github.com/nahi/httpclient/blob/master/lib/httpclient/cookie.rb#L177
  • https://github.com/nahi/httpclient/blob/master/lib/httpclient/cookie.rb#L208-L213

dazza-codes avatar Oct 13 '15 21:10 dazza-codes

PR https://github.com/nahi/httpclient/pull/268

dazza-codes avatar Oct 13 '15 22:10 dazza-codes

Okay, what confuses me about this is I used to get it when testing/using my MediaWiki::Butt gem, but it stopped so long ago and I don't remember how I may have "fixed" it. And even still, it happens for another user using basically identical code to mine.

elifoster avatar Oct 14 '15 00:10 elifoster

O totally agree, is there any way to remove this annoying warning?

vnazarenko avatar Nov 17 '15 12:11 vnazarenko

class WebAgent
  class Cookie < HTTP::Cookie
    def domain
      self.original_domain
    end
  end
end

^ is how I removed the warning. It'd be nice if there was an option to ignore the warning.

bootstraponline avatar May 18 '17 14:05 bootstraponline