diaspora_federation 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 126bd285db912266d404ee6db4fb7016291438fee3089341f60a257e64386ad6
|
4
|
+
data.tar.gz: 4e6301e3937258f34771d6a373618f0f24ebe230d7f9004bd2173f00b653ab30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf115ea37e268d101a94b1df2fcab533f147a238861813742800aa77edf287a8b23e6a2473344817e203374af884f2fc81ed470a0fab91d6b40891d8d58f9c29
|
7
|
+
data.tar.gz: 25749275957489227c092294b25c8d04809a4d79f42512f09941b0881dd9193eb94fe7716c292416c5e40bd7695dab835297e139bf243bfb535c81ac27413c7c
|
data/Changelog.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 1.1.0
|
2
|
+
|
3
|
+
* Don't follow redirects when federating messages [#128](https://github.com/diaspora/diaspora_federation/pull/128)
|
4
|
+
|
1
5
|
# 1.0.1
|
2
6
|
|
3
7
|
* Disable rails forgery protection for the federation controller by default [#127](https://github.com/diaspora/diaspora_federation/pull/127)
|
@@ -15,8 +15,7 @@ module DiasporaFederation
|
|
15
15
|
# @return [Hash] hydra opts
|
16
16
|
def self.hydra_opts
|
17
17
|
@hydra_opts ||= {
|
18
|
-
followlocation:
|
19
|
-
maxredirs: DiasporaFederation.http_redirect_limit,
|
18
|
+
followlocation: false,
|
20
19
|
timeout: DiasporaFederation.http_timeout,
|
21
20
|
method: :post,
|
22
21
|
verbose: DiasporaFederation.http_verbose,
|
@@ -90,10 +89,10 @@ module DiasporaFederation
|
|
90
89
|
# @param [Typhoeus::Request] request
|
91
90
|
def prepare_request(request)
|
92
91
|
request.on_complete do |response|
|
93
|
-
|
94
|
-
log_line = "success=#{success} sender=#{@sender_id} obj=#{@obj_str} url=#{
|
92
|
+
DiasporaFederation.callbacks.trigger(:update_pod, request.url, status_from_response(response))
|
93
|
+
log_line = "success=#{response.success?} sender=#{@sender_id} obj=#{@obj_str} url=#{request.url} " \
|
95
94
|
"message=#{response.return_code} code=#{response.response_code} time=#{response.total_time}"
|
96
|
-
if success
|
95
|
+
if response.success?
|
97
96
|
logger.info(log_line)
|
98
97
|
else
|
99
98
|
logger.warn(log_line)
|
@@ -103,18 +102,6 @@ module DiasporaFederation
|
|
103
102
|
end
|
104
103
|
end
|
105
104
|
|
106
|
-
def validate_response_and_update_pod(request, response)
|
107
|
-
url = URI.parse(request.url)
|
108
|
-
effective_url = URI.parse(response.effective_url)
|
109
|
-
same_host = url.host == effective_url.host
|
110
|
-
|
111
|
-
(response.success? && same_host).tap do |success|
|
112
|
-
pod_url = (success ? effective_url : url).tap {|uri| uri.path = "/" }.to_s
|
113
|
-
status = same_host ? status_from_response(response) : :redirected_to_other_hostname
|
114
|
-
DiasporaFederation.callbacks.trigger(:update_pod, pod_url, status)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
105
|
def status_from_response(response)
|
119
106
|
response.return_code == :ok ? response.response_code : response.return_code
|
120
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diaspora_federation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Neff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
223
|
+
rubygems_version: 3.4.10
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: diaspora* federation library
|