Fix request bug.
This commit is contained in:
parent
b162819874
commit
e961a3c26d
|
@ -53,6 +53,21 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
@table_feed_fields = ["announcement.time", "announcement.comment", "announcement.account","ip","is_hidden"]
|
@table_feed_fields = ["announcement.time", "announcement.comment", "announcement.account","ip","is_hidden"]
|
||||||
@comments = @bulletin.bulletin_comments.reverse rescue []
|
@comments = @bulletin.bulletin_comments.reverse rescue []
|
||||||
end
|
end
|
||||||
|
def http_request(http, request)
|
||||||
|
response = http.request(request)
|
||||||
|
if response.code.to_i == 301 || response.code.to_i == 302
|
||||||
|
location = response["location"]
|
||||||
|
new_uri = URI(location)
|
||||||
|
http = Net::HTTP.new(new_uri.host, new_uri.port)
|
||||||
|
if location.include?('https')
|
||||||
|
http.use_ssl = true
|
||||||
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||||
|
end
|
||||||
|
request.instance_variable_set(:@path, new_uri.path)
|
||||||
|
response = http_request(http, request)
|
||||||
|
end
|
||||||
|
response
|
||||||
|
end
|
||||||
def index
|
def index
|
||||||
Bulletin.remove_expired_status
|
Bulletin.remove_expired_status
|
||||||
@tags = @module_app.tags
|
@tags = @module_app.tags
|
||||||
|
@ -329,7 +344,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
if remote_url.include?('https')
|
if remote_url.include?('https')
|
||||||
http_req.use_ssl = true
|
http_req.use_ssl = true
|
||||||
end
|
end
|
||||||
response = http_req.request(request)
|
response = http_request( http_req , request )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -437,7 +452,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
if remote_url.include?('https')
|
if remote_url.include?('https')
|
||||||
http_req.use_ssl = true
|
http_req.use_ssl = true
|
||||||
end
|
end
|
||||||
response = http_req.request(request)
|
response = http_request( http_req , request )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -465,7 +480,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
if remote_url.include?('https')
|
if remote_url.include?('https')
|
||||||
http_req.use_ssl = true
|
http_req.use_ssl = true
|
||||||
end
|
end
|
||||||
response = http_req.request(request)
|
response = http_request( http_req , request )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -495,7 +510,7 @@ class Admin::AnnouncementsController < OrbitAdminController
|
||||||
if remote_url.include?('https')
|
if remote_url.include?('https')
|
||||||
http_req.use_ssl = true
|
http_req.use_ssl = true
|
||||||
end
|
end
|
||||||
response = http_req.request(request)
|
response = http_request( http_req , request )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue