nice_http 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/nice_http.rb +14 -5
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92ebebe91168e61013d74f0aa1e66d3d0fb7226b99037a57d5d05ffa8bc2d419
|
4
|
+
data.tar.gz: 77f069d9b59dfafb0d156a45cf2549c2fd575b3b009860cacc13bd2ef5ac6e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e2211f5aff7555d45b53d48ea5379d9865c2278ebb9f3655fe1169e555a3ed298846a2bba682275621a6639857bf347fcb3ad01cec1d687c5474eb0bf073764
|
7
|
+
data.tar.gz: 01f0d5ce1ab751770be616a43bd00975f8c7d783c0b89c900491a923420a5b64585acf0af66680acfe7639883b586877ee2299743c74e524348ab9342b2c500f
|
data/README.md
CHANGED
@@ -315,6 +315,10 @@ The output:
|
|
315
315
|
|
316
316
|
```
|
317
317
|
|
318
|
+
You can see on the next link how to get the OAuth2 token for Microsoft Azure and add it to your Http connection header.
|
319
|
+
|
320
|
+
https://gist.github.com/MarioRuiz/d3525185024737885c0c9afa6dc8b9e5
|
321
|
+
|
318
322
|
|
319
323
|
## Send multipart content
|
320
324
|
|
data/lib/nice_http.rb
CHANGED
@@ -77,6 +77,7 @@ class NiceHttp
|
|
77
77
|
@connections = []
|
78
78
|
@active = 0
|
79
79
|
@auto_redirect = true
|
80
|
+
@delete_log_file_content = true
|
80
81
|
end
|
81
82
|
reset!
|
82
83
|
|
@@ -193,16 +194,23 @@ class NiceHttp
|
|
193
194
|
end
|
194
195
|
|
195
196
|
begin
|
197
|
+
#only the first connection in the run will be deleting
|
198
|
+
if @delete_log_file_content
|
199
|
+
mode = "w"
|
200
|
+
@delete_log_file_content = false
|
201
|
+
else
|
202
|
+
mode = "a"
|
203
|
+
end
|
196
204
|
if @log.kind_of?(String)
|
197
|
-
f = File.new(@log,
|
205
|
+
f = File.new(@log, mode)
|
198
206
|
f.sync = true
|
199
207
|
@logger = Logger.new f
|
200
208
|
elsif @log == :fix_file
|
201
|
-
f = File.new("nice_http.log",
|
209
|
+
f = File.new("nice_http.log", mode)
|
202
210
|
f.sync = true
|
203
211
|
@logger = Logger.new f
|
204
212
|
elsif @log == :file
|
205
|
-
f = File.new("nice_http_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}.log",
|
213
|
+
f = File.new("nice_http_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}.log", mode)
|
206
214
|
f.sync = true
|
207
215
|
@logger = Logger.new f
|
208
216
|
elsif @log == :screen
|
@@ -327,7 +335,7 @@ class NiceHttp
|
|
327
335
|
ssl = true if path.include?("https:")
|
328
336
|
|
329
337
|
server = "http://"
|
330
|
-
server = "https://" if path.
|
338
|
+
server = "https://" if path.start_with?("https:")
|
331
339
|
if uri.port != 443
|
332
340
|
server += "#{uri.host}:#{uri.port}"
|
333
341
|
else
|
@@ -346,7 +354,8 @@ class NiceHttp
|
|
346
354
|
path, data, headers_t = manage_request(arg)
|
347
355
|
http_redir.cookies.merge!(@cookies)
|
348
356
|
http_redir.headers.merge!(headers_t)
|
349
|
-
|
357
|
+
#todo: remove only the server at the begining in case in query is the server it will be replaced when it should not be
|
358
|
+
resp = http_redir.get(path.gsub(server, ""))
|
350
359
|
@response = http_redir.response
|
351
360
|
else
|
352
361
|
@logger.warn "It seems like the http connection cannot redirect to #{server} because there is no active connection for that server. You need to create previously one."
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nice_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nice_hash
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
22
|
+
version: 1.9.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.9'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
32
|
+
version: 1.9.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|