tilia-http 4.1.0.8 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.sabre.md +15 -0
- data/Gemfile +1 -9
- data/Gemfile.lock +16 -10
- data/examples/asyncclient.rb +1 -5
- data/examples/basicauth.rb +1 -5
- data/examples/client.rb +1 -5
- data/examples/digestauth.rb +37 -0
- data/examples/reverseproxy.rb +1 -1
- data/examples/stringify.rb +1 -5
- data/lib/tilia/http/auth/abstract_auth.rb +0 -19
- data/lib/tilia/http/auth/aws.rb +7 -21
- data/lib/tilia/http/auth/digest.rb +15 -26
- data/lib/tilia/http/client.rb +23 -66
- data/lib/tilia/http/client_exception.rb +1 -1
- data/lib/tilia/http/client_http_exception.rb +2 -11
- data/lib/tilia/http/http_exception.rb +1 -1
- data/lib/tilia/http/message.rb +33 -140
- data/lib/tilia/http/message_decorator_trait.rb +15 -113
- data/lib/tilia/http/message_interface.rb +19 -18
- data/lib/tilia/http/request.rb +21 -121
- data/lib/tilia/http/request_decorator.rb +15 -77
- data/lib/tilia/http/request_interface.rb +11 -11
- data/lib/tilia/http/response.rb +13 -41
- data/lib/tilia/http/response_decorator.rb +4 -19
- data/lib/tilia/http/response_interface.rb +3 -3
- data/lib/tilia/http/sapi.rb +4 -4
- data/lib/tilia/http/url_util.rb +2 -2
- data/lib/tilia/http/util.rb +5 -5
- data/lib/tilia/http/version.rb +1 -1
- data/lib/tilia/http.rb +9 -9
- data/test/http/message_test.rb +24 -4
- data/test/http/url_util_test.rb +1 -1
- data/tilia-http.gemspec +1 -1
- metadata +7 -6
data/lib/tilia/http/request.rb
CHANGED
@@ -9,67 +9,40 @@ module Tilia
|
|
9
9
|
include Tilia::Http::Message
|
10
10
|
include Tilia::Http::RequestInterface
|
11
11
|
|
12
|
-
protected
|
13
|
-
|
14
|
-
# HTTP Method
|
15
|
-
#
|
16
|
-
# @return [String]
|
17
|
-
attr_accessor :method
|
18
|
-
|
19
|
-
# Request Url
|
20
|
-
#
|
21
|
-
# @return [String]
|
22
|
-
attr_accessor :url
|
23
|
-
|
24
|
-
public
|
25
|
-
|
26
12
|
# Creates the request object
|
27
13
|
#
|
28
14
|
# @param [String] method
|
29
15
|
# @param [String] url
|
30
|
-
# @param
|
31
|
-
# @param
|
16
|
+
# @param [Hash] headers
|
17
|
+
# @param [String, IO] body
|
32
18
|
def initialize(method = nil, url = nil, headers = nil, body = nil)
|
33
|
-
|
19
|
+
super()
|
20
|
+
|
34
21
|
@base_url = '/' # RUBY
|
35
22
|
@post_data = {}
|
36
23
|
@raw_server_data = {}
|
37
24
|
|
38
25
|
fail ArgumentError, 'The first argument for this constructor should be a string or null, not an array. Did you upgrade from sabre/http 1.0 to 2.0?' if method.is_a?(Array)
|
39
26
|
|
40
|
-
|
41
|
-
|
27
|
+
@method = method if method
|
28
|
+
@url = url if url
|
42
29
|
update_headers(headers) if headers
|
43
|
-
|
30
|
+
@body = body if body
|
44
31
|
end
|
45
32
|
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# @return [String]
|
33
|
+
# (see RequestInterface#method)
|
49
34
|
attr_reader :method
|
50
35
|
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# @param [String] method
|
54
|
-
# @return [void]
|
36
|
+
# (see RequestInterface#method=)
|
55
37
|
attr_writer :method
|
56
38
|
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# @return [String]
|
39
|
+
# (see RequestInterface#url)
|
60
40
|
attr_reader :url
|
61
41
|
|
62
|
-
#
|
63
|
-
#
|
64
|
-
# @param [String] url
|
65
|
-
# @return [void]
|
42
|
+
# (see RequestInterface#url=)
|
66
43
|
attr_writer :url
|
67
44
|
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# This is equivalent to PHP's $_GET superglobal.
|
71
|
-
#
|
72
|
-
# @return array
|
45
|
+
# (see RequestInterface#query_parameters)
|
73
46
|
def query_parameters
|
74
47
|
url = self.url
|
75
48
|
|
@@ -85,54 +58,19 @@ module Tilia
|
|
85
58
|
end
|
86
59
|
end
|
87
60
|
|
88
|
-
#
|
89
|
-
#
|
90
|
-
# @param [String] url
|
91
|
-
# @return [void]
|
61
|
+
# (see RequestInterface#absolute_url=)
|
92
62
|
attr_writer :absolute_url
|
93
63
|
|
94
|
-
#
|
95
|
-
#
|
96
|
-
# @return [String]
|
64
|
+
# (see RequestInterface#absolute_url)
|
97
65
|
attr_reader :absolute_url
|
98
66
|
|
99
|
-
|
100
|
-
|
101
|
-
# Base url
|
102
|
-
#
|
103
|
-
# @return [String]
|
104
|
-
attr_accessor :base_url
|
105
|
-
|
106
|
-
public
|
107
|
-
|
108
|
-
# Sets a base url.
|
109
|
-
#
|
110
|
-
# This url is used for relative path calculations.
|
111
|
-
#
|
112
|
-
# @param [String] url
|
113
|
-
# @return [void]
|
67
|
+
# (see RequestInterface#base_url=)
|
114
68
|
attr_writer :base_url
|
115
69
|
|
116
|
-
#
|
117
|
-
#
|
118
|
-
# @return [String]
|
70
|
+
# (see RequestInterface#base_url)
|
119
71
|
attr_reader :base_url
|
120
72
|
|
121
|
-
#
|
122
|
-
#
|
123
|
-
# This is being calculated using the base url. This path will not start
|
124
|
-
# with a slash, so it will always return something like
|
125
|
-
# 'example/path.html'.
|
126
|
-
#
|
127
|
-
# If the full path is equal to the base url, this method will return an
|
128
|
-
# empty string.
|
129
|
-
#
|
130
|
-
# This method will also urldecode the path, and if the url was incoded as
|
131
|
-
# ISO-8859-1, it will convert it to UTF-8.
|
132
|
-
#
|
133
|
-
# If the path is outside of the base url, a LogicException will be thrown.
|
134
|
-
#
|
135
|
-
# @return [String]
|
73
|
+
# (see RequestInterface#path)
|
136
74
|
def path
|
137
75
|
# Removing duplicated slashes.
|
138
76
|
uri = (url || '').gsub('//', '/')
|
@@ -153,56 +91,18 @@ module Tilia
|
|
153
91
|
fail "Requested uri (#{url}) is out of base uri (#{base_url})"
|
154
92
|
end
|
155
93
|
|
156
|
-
|
157
|
-
|
158
|
-
# Equivalent of PHP's $_POST.
|
159
|
-
#
|
160
|
-
# @return array
|
161
|
-
attr_accessor :post_data
|
162
|
-
|
163
|
-
public
|
164
|
-
|
165
|
-
# Sets the post data.
|
166
|
-
#
|
167
|
-
# This is equivalent to PHP's $_POST superglobal.
|
168
|
-
#
|
169
|
-
# This would not have been needed, if POST data was accessible as
|
170
|
-
# php://input, but unfortunately we need to special case it.
|
171
|
-
#
|
172
|
-
# @param array post_data
|
173
|
-
# @return [void]
|
94
|
+
# (see RequestInterface#post_data=)
|
174
95
|
attr_writer :post_data
|
175
96
|
|
176
|
-
#
|
177
|
-
#
|
178
|
-
# This is equivalent to PHP's $_POST superglobal.
|
179
|
-
#
|
180
|
-
# @return array
|
97
|
+
# (see RequestInterface#post_data)
|
181
98
|
attr_reader :post_data
|
182
99
|
|
183
|
-
|
184
|
-
|
185
|
-
# An array containing the raw _SERVER array.
|
186
|
-
#
|
187
|
-
# @return array
|
188
|
-
attr_accessor :raw_server_data
|
189
|
-
|
190
|
-
public
|
191
|
-
|
192
|
-
# Returns an item from the _SERVER array.
|
193
|
-
#
|
194
|
-
# If the value does not exist in the array, null is returned.
|
195
|
-
#
|
196
|
-
# @param [String] value_name
|
197
|
-
# @return [String, nil]
|
100
|
+
# (see RequestInterface#raw_server_value)
|
198
101
|
def raw_server_value(value_name)
|
199
102
|
@raw_server_data[value_name]
|
200
103
|
end
|
201
104
|
|
202
|
-
#
|
203
|
-
#
|
204
|
-
# @param array data
|
205
|
-
# @return [void]
|
105
|
+
# (see RequestInterface#raw_server_data=)
|
206
106
|
def raw_server_data=(data)
|
207
107
|
@raw_server_data = data.dup
|
208
108
|
end
|
@@ -10,139 +10,77 @@ module Tilia
|
|
10
10
|
|
11
11
|
# Constructor.
|
12
12
|
#
|
13
|
-
# @param RequestInterface inner
|
13
|
+
# @param [RequestInterface] inner
|
14
14
|
def initialize(inner)
|
15
15
|
@inner = inner
|
16
16
|
end
|
17
17
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# @return [String]
|
18
|
+
# (see RequestInterface#method)
|
21
19
|
def method
|
22
20
|
@inner.method
|
23
21
|
end
|
24
22
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# @param [String] method
|
28
|
-
# @return [void]
|
23
|
+
# (see RequestInterface#method=)
|
29
24
|
def method=(method)
|
30
25
|
@inner.method = method
|
31
26
|
end
|
32
27
|
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# @return [String]
|
28
|
+
# (see RequestInterface#url)
|
36
29
|
def url
|
37
30
|
@inner.url
|
38
31
|
end
|
39
32
|
|
40
|
-
#
|
41
|
-
#
|
42
|
-
# @param [String] url
|
43
|
-
# @return [void]
|
33
|
+
# (see RequestInterface#url=)
|
44
34
|
def url=(url)
|
45
35
|
@inner.url = url
|
46
36
|
end
|
47
37
|
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# @return [String]
|
38
|
+
# (see RequestInterface#absolute_url)
|
51
39
|
def absolute_url
|
52
40
|
@inner.absolute_url
|
53
41
|
end
|
54
42
|
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# @param [String] url
|
58
|
-
# @return [void]
|
43
|
+
# (see RequestInterface#absolute_url=)
|
59
44
|
def absolute_url=(url)
|
60
45
|
@inner.absolute_url = url
|
61
46
|
end
|
62
47
|
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# @return [String]
|
48
|
+
# (see RequestInterface#base_url)
|
66
49
|
def base_url
|
67
50
|
@inner.base_url
|
68
51
|
end
|
69
52
|
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# This url is used for relative path calculations.
|
73
|
-
#
|
74
|
-
# The base url should default to /
|
75
|
-
#
|
76
|
-
# @param [String] url
|
77
|
-
# @return [void]
|
53
|
+
# (see RequestInterface#base_url=)
|
78
54
|
def base_url=(url)
|
79
55
|
@inner.base_url = url
|
80
56
|
end
|
81
57
|
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# This is being calculated using the base url. This path will not start
|
85
|
-
# with a slash, so it will always return something like
|
86
|
-
# 'example/path.html'.
|
87
|
-
#
|
88
|
-
# If the full path is equal to the base url, this method will return an
|
89
|
-
# empty string.
|
90
|
-
#
|
91
|
-
# This method will also urldecode the path, and if the url was incoded as
|
92
|
-
# ISO-8859-1, it will convert it to UTF-8.
|
93
|
-
#
|
94
|
-
# If the path is outside of the base url, a LogicException will be thrown.
|
95
|
-
#
|
96
|
-
# @return [String]
|
58
|
+
# (see RequestInterface#path)
|
97
59
|
def path
|
98
60
|
@inner.path
|
99
61
|
end
|
100
62
|
|
101
|
-
#
|
102
|
-
#
|
103
|
-
# This is equivalent to PHP's $_GET superglobal.
|
104
|
-
#
|
105
|
-
# @return array
|
63
|
+
# (see RequestInterface#query_parameters)
|
106
64
|
def query_parameters
|
107
65
|
@inner.query_parameters
|
108
66
|
end
|
109
67
|
|
110
|
-
#
|
111
|
-
#
|
112
|
-
# This is equivalent to PHP's $_POST superglobal.
|
113
|
-
#
|
114
|
-
# @return array
|
68
|
+
# (see RequestInterface#post_data)
|
115
69
|
def post_data
|
116
70
|
@inner.post_data
|
117
71
|
end
|
118
72
|
|
119
|
-
#
|
120
|
-
#
|
121
|
-
# This is equivalent to PHP's $_POST superglobal.
|
122
|
-
#
|
123
|
-
# This would not have been needed, if POST data was accessible as
|
124
|
-
# php://input, but unfortunately we need to special case it.
|
125
|
-
#
|
126
|
-
# @param array post_data
|
127
|
-
# @return [void]
|
73
|
+
# (see RequestInterface#post_data=)
|
128
74
|
def post_data=(post_data)
|
129
75
|
@inner.post_data = post_data
|
130
76
|
end
|
131
77
|
|
132
|
-
#
|
133
|
-
#
|
134
|
-
# If the value does not exist in the array, null is returned.
|
135
|
-
#
|
136
|
-
# @param [String] value_name
|
137
|
-
# @return [String, nil]
|
78
|
+
# (see RequestInterface#raw_server_value)
|
138
79
|
def raw_server_value(value_name)
|
139
80
|
@inner.raw_server_value(value_name)
|
140
81
|
end
|
141
82
|
|
142
|
-
#
|
143
|
-
#
|
144
|
-
# @param array data
|
145
|
-
# @return [void]
|
83
|
+
# (see RequestInterface#raw_server_data=)
|
146
84
|
def raw_server_data=(data)
|
147
85
|
@inner.raw_server_data = data
|
148
86
|
end
|
@@ -14,7 +14,7 @@ module Tilia
|
|
14
14
|
#
|
15
15
|
# @param [String] method
|
16
16
|
# @return [void]
|
17
|
-
def method=(
|
17
|
+
def method=(method)
|
18
18
|
end
|
19
19
|
|
20
20
|
# Returns the request url.
|
@@ -27,7 +27,7 @@ module Tilia
|
|
27
27
|
#
|
28
28
|
# @param [String] url
|
29
29
|
# @return [void]
|
30
|
-
def url=(
|
30
|
+
def url=(url)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Returns the absolute url.
|
@@ -40,7 +40,7 @@ module Tilia
|
|
40
40
|
#
|
41
41
|
# @param [String] url
|
42
42
|
# @return [void]
|
43
|
-
def absolute_url=(
|
43
|
+
def absolute_url=(url)
|
44
44
|
end
|
45
45
|
|
46
46
|
# Returns the current base url.
|
@@ -57,7 +57,7 @@ module Tilia
|
|
57
57
|
#
|
58
58
|
# @param [String] url
|
59
59
|
# @return [void]
|
60
|
-
def base_url=(
|
60
|
+
def base_url=(url)
|
61
61
|
end
|
62
62
|
|
63
63
|
# Returns the relative path.
|
@@ -82,7 +82,7 @@ module Tilia
|
|
82
82
|
#
|
83
83
|
# This is equivalent to PHP's $_GET superglobal.
|
84
84
|
#
|
85
|
-
# @return
|
85
|
+
# @return [Hash]
|
86
86
|
def query_parameters
|
87
87
|
end
|
88
88
|
|
@@ -90,7 +90,7 @@ module Tilia
|
|
90
90
|
#
|
91
91
|
# This is equivalent to PHP's $_POST superglobal.
|
92
92
|
#
|
93
|
-
# @return
|
93
|
+
# @return [Hash]
|
94
94
|
def post_data
|
95
95
|
end
|
96
96
|
|
@@ -101,9 +101,9 @@ module Tilia
|
|
101
101
|
# This would not have been needed, if POST data was accessible as
|
102
102
|
# php://input, but unfortunately we need to special case it.
|
103
103
|
#
|
104
|
-
# @param
|
104
|
+
# @param [Hash] post_data
|
105
105
|
# @return [void]
|
106
|
-
def post_data=(
|
106
|
+
def post_data=(post_data)
|
107
107
|
end
|
108
108
|
|
109
109
|
# Returns an item from the _SERVER array.
|
@@ -112,14 +112,14 @@ module Tilia
|
|
112
112
|
#
|
113
113
|
# @param [String] value_name
|
114
114
|
# @return [String, nil]
|
115
|
-
def raw_server_value(
|
115
|
+
def raw_server_value(value_name)
|
116
116
|
end
|
117
117
|
|
118
118
|
# Sets the _SERVER array.
|
119
119
|
#
|
120
|
-
# @param
|
120
|
+
# @param [Hash] data
|
121
121
|
# @return [void]
|
122
|
-
def raw_server_data=(
|
122
|
+
def raw_server_data=(data)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
data/lib/tilia/http/response.rb
CHANGED
@@ -74,61 +74,31 @@ module Tilia
|
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
77
|
-
protected
|
78
|
-
|
79
|
-
# HTTP status code
|
80
|
-
#
|
81
|
-
# @return int
|
82
|
-
attr_accessor :status
|
83
|
-
|
84
|
-
# HTTP status text
|
85
|
-
#
|
86
|
-
# @return [String]
|
87
|
-
attr_accessor :status_text
|
88
|
-
|
89
|
-
public
|
90
|
-
|
91
77
|
# Creates the response object
|
92
78
|
#
|
93
79
|
# @param [String, Fixnum] status
|
94
|
-
# @param
|
95
|
-
# @param
|
80
|
+
# @param [Hash] headers
|
81
|
+
# @param [String, IO] body
|
96
82
|
# @return [void]
|
97
83
|
def initialize(status = nil, headers = nil, body = nil)
|
98
|
-
|
84
|
+
super()
|
99
85
|
|
100
|
-
self.status = status if status
|
86
|
+
self.status = status if status # Don't set @status directly!
|
101
87
|
update_headers(headers) if headers
|
102
|
-
|
88
|
+
@body = body if body
|
103
89
|
end
|
104
90
|
|
105
|
-
#
|
106
|
-
#
|
107
|
-
# @return int
|
91
|
+
# (see ResponseInterface#status)
|
108
92
|
attr_reader :status
|
109
93
|
|
110
|
-
#
|
111
|
-
#
|
112
|
-
# In the case of a 200, this may for example be 'OK'.
|
113
|
-
#
|
114
|
-
# @return [String]
|
94
|
+
# (see ResponseInterface#status_text)
|
115
95
|
attr_reader :status_text
|
116
96
|
|
117
|
-
#
|
118
|
-
#
|
119
|
-
# This can be either the full HTTP status code with human readable string,
|
120
|
-
# for example: "403 I can't let you do that, Dave".
|
121
|
-
#
|
122
|
-
# Or just the code, in which case the appropriate default message will be
|
123
|
-
# added.
|
124
|
-
#
|
125
|
-
# @param [String, Fixnum] status
|
126
|
-
# @throws \InvalidArgumentExeption
|
127
|
-
# @return [void]
|
97
|
+
# (see ResponseInterface#status=)
|
128
98
|
def status=(status)
|
129
99
|
if status.is_a?(Fixnum) || status =~ /^\d+$/
|
130
100
|
status_code = status
|
131
|
-
status_text =
|
101
|
+
status_text = Response.status_codes.key?(status.to_i) ? Response.status_codes[status.to_i] : 'Unkown'
|
132
102
|
else
|
133
103
|
(
|
134
104
|
status_code,
|
@@ -136,9 +106,11 @@ module Tilia
|
|
136
106
|
) = status.split(' ', 2)
|
137
107
|
end
|
138
108
|
|
139
|
-
|
109
|
+
status_code = status_code.to_i unless status_code.is_a?(Fixnum)
|
110
|
+
|
111
|
+
fail ArgumentError, 'The HTTP status code must be exactly 3 digits' if status_code < 100 || status_code > 999
|
140
112
|
|
141
|
-
@status = status_code
|
113
|
+
@status = status_code
|
142
114
|
@status_text = status_text
|
143
115
|
end
|
144
116
|
|
@@ -10,37 +10,22 @@ module Tilia
|
|
10
10
|
|
11
11
|
# Constructor.
|
12
12
|
#
|
13
|
-
# @param ResponseInterface inner
|
13
|
+
# @param [ResponseInterface] inner
|
14
14
|
def initialize(inner)
|
15
15
|
@inner = inner
|
16
16
|
end
|
17
17
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# @return int
|
18
|
+
# (see ResponseInterface#status)
|
21
19
|
def status
|
22
20
|
@inner.status
|
23
21
|
end
|
24
22
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# In the case of a 200, this may for example be 'OK'.
|
28
|
-
#
|
29
|
-
# @return [String]
|
23
|
+
# (see ResponseInterface#status_text)
|
30
24
|
def status_text
|
31
25
|
@inner.status_text
|
32
26
|
end
|
33
27
|
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# This can be either the full HTTP status code with human readable string,
|
37
|
-
# for example: "403 I can't let you do that, Dave".
|
38
|
-
#
|
39
|
-
# Or just the code, in which case the appropriate default message will be
|
40
|
-
# added.
|
41
|
-
#
|
42
|
-
# @param [String, Fixnum] status
|
43
|
-
# @return [void]
|
28
|
+
# (see ResponseInterface#status=)
|
44
29
|
def status=(status)
|
45
30
|
@inner.status = status
|
46
31
|
end
|
@@ -6,7 +6,7 @@ module Tilia
|
|
6
6
|
|
7
7
|
# Returns the current HTTP status code.
|
8
8
|
#
|
9
|
-
# @return
|
9
|
+
# @return [Fixnum]
|
10
10
|
def status
|
11
11
|
end
|
12
12
|
|
@@ -27,9 +27,9 @@ module Tilia
|
|
27
27
|
# added.
|
28
28
|
#
|
29
29
|
# @param [String, Fixnum] status
|
30
|
-
# @
|
30
|
+
# @raise [ArgumentError] if the status code deoes not have 3 digits
|
31
31
|
# @return [void]
|
32
|
-
def status=(
|
32
|
+
def status=(status)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/tilia/http/sapi.rb
CHANGED
@@ -26,7 +26,7 @@ module Tilia
|
|
26
26
|
# This static method will create a new Request object, based on the
|
27
27
|
# current PHP request.
|
28
28
|
#
|
29
|
-
# @return Request
|
29
|
+
# @return [Request]
|
30
30
|
def self.request
|
31
31
|
fail NotImplementedError, 'This object method now is an instance method'
|
32
32
|
end
|
@@ -35,7 +35,7 @@ module Tilia
|
|
35
35
|
#
|
36
36
|
# This calls php's header function and streams the body to php://output.
|
37
37
|
#
|
38
|
-
# @param ResponseInterface response
|
38
|
+
# @param [ResponseInterface] response
|
39
39
|
# @return [void]
|
40
40
|
def self.send_response(response)
|
41
41
|
# RUBY: Rack does not support HTTP Version (?)
|
@@ -62,8 +62,8 @@ module Tilia
|
|
62
62
|
# This static method will create a new Request object, based on a PHP
|
63
63
|
# $_SERVER array.
|
64
64
|
#
|
65
|
-
# @param
|
66
|
-
# @return Request
|
65
|
+
# @param [Hash] server_array
|
66
|
+
# @return [Request]
|
67
67
|
def self.create_from_server_array(server_array)
|
68
68
|
headers = {}
|
69
69
|
method = nil
|
data/lib/tilia/http/url_util.rb
CHANGED
@@ -5,7 +5,7 @@ module Tilia
|
|
5
5
|
# Note: this class is deprecated. All its functionality moved to functions.php
|
6
6
|
# or sabre\uri.
|
7
7
|
#
|
8
|
-
# @
|
8
|
+
# @deprecated
|
9
9
|
module UrlUtil
|
10
10
|
# Encodes the path of a url.
|
11
11
|
#
|
@@ -51,7 +51,7 @@ module Tilia
|
|
51
51
|
#
|
52
52
|
# @deprecated Use Sabre\Uri\split.
|
53
53
|
# @param [String] path
|
54
|
-
# @return
|
54
|
+
# @return [Array]
|
55
55
|
def self.split_path(path)
|
56
56
|
Tilia::Uri.split(path)
|
57
57
|
end
|
data/lib/tilia/http/util.rb
CHANGED
@@ -8,7 +8,7 @@ module Tilia
|
|
8
8
|
#
|
9
9
|
# @deprecated Use Tilia::Http::negotiate_content_type
|
10
10
|
# @param [String, nil] accept_header_value
|
11
|
-
# @param
|
11
|
+
# @param [Array<String>] available_options
|
12
12
|
# @return [String, nil]
|
13
13
|
def self.negotiate_content_type(accept_header_value, available_options)
|
14
14
|
Http.negotiate_content_type(accept_header_value, available_options)
|
@@ -17,8 +17,8 @@ module Tilia
|
|
17
17
|
# Deprecated! Use negotiateContentType.
|
18
18
|
#
|
19
19
|
# @deprecated Use Tilia::Http::negotiate_content_type
|
20
|
-
# @param [String, nil]
|
21
|
-
# @param
|
20
|
+
# @param [String, nil] accept_header_value
|
21
|
+
# @param [Array<String>] available_options
|
22
22
|
# @return [String, nil]
|
23
23
|
def self.negotiate(accept_header_value, available_options)
|
24
24
|
Http.negotiate_content_type(accept_header_value, available_options)
|
@@ -30,7 +30,7 @@ module Tilia
|
|
30
30
|
#
|
31
31
|
# @deprecated Use Tilia::Http::parse_date
|
32
32
|
# @param [String] date_header
|
33
|
-
# @return
|
33
|
+
# @return [Time, nil]
|
34
34
|
def self.parse_http_date(date_header)
|
35
35
|
Http.parse_date(date_header)
|
36
36
|
end
|
@@ -41,7 +41,7 @@ module Tilia
|
|
41
41
|
# specified as GMT.
|
42
42
|
#
|
43
43
|
# @deprecated Use Tilia::Http::to_date
|
44
|
-
# @param
|
44
|
+
# @param [Time] date_time
|
45
45
|
# @return [String]
|
46
46
|
def self.to_http_date(date_time)
|
47
47
|
Http.to_date(date_time)
|