SSL Error on HTTP POST (Unknown Protocol)

前端 未结 2 1554
谎友^
谎友^ 2021-02-10 02:40

Trying to connect to Imgur API via SSL gives me an error. Here\'s the code and the error:

  API_URI = URI.parse(\'https://api.imgur.com\')
  API_PUBLIC_KEY = \'C         


        
2条回答
  •  忘了有多久
    2021-02-10 03:20

    Specifying the port when creating the HTTP client fixed this problem.

    http = Net::HTTP.new(API_URI.host, API_URI.port)
    

    or

    http = Net::HTTP.new(API_URI.host, 443)
    

提交回复
热议问题