stream_parser 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stream_parser.rb +18 -4
- data/lib/stream_parser/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b99a423c7791ac03b0e45b390d22c10b455b45e51066edb1912eb4c9aec7a65
|
4
|
+
data.tar.gz: edb3c225aeaff8d4400e0929a8bde7120326ab95c39fe42c11c8d4bf6f8ba2ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ae770c7090a31b80abc9b7c216de440e61ca38d87476e17ef855ba37aa90a30bd1cb7f990831b0ebd68fead35a385d98c7307b608e9f34759d54dfcfd43fe3
|
7
|
+
data.tar.gz: 2ce893bdd9e79aa3b094ba15bc612ac598f1e11b0325bf5fa3e44a521ff678ada20705e805cef40314eeb4a274d7e877603b5dfc4ee6ffbebc96b23980e370aa
|
data/lib/stream_parser.rb
CHANGED
@@ -24,7 +24,7 @@ module StreamParser
|
|
24
24
|
# end
|
25
25
|
|
26
26
|
def eos?
|
27
|
-
@index >= (@source.size -
|
27
|
+
@index >= (@source.size - 0)
|
28
28
|
end
|
29
29
|
|
30
30
|
def scan_until(r)
|
@@ -39,13 +39,13 @@ module StreamParser
|
|
39
39
|
else
|
40
40
|
@match = nil
|
41
41
|
@old_index = @index
|
42
|
-
@index = @source.size
|
42
|
+
@index = @source.size
|
43
43
|
end
|
44
44
|
match
|
45
45
|
end
|
46
46
|
|
47
47
|
def pre_match
|
48
|
-
@source[@old_index...(@index
|
48
|
+
@source[@old_index...(@index-(@match&.size || 0))]
|
49
49
|
end
|
50
50
|
|
51
51
|
def rewind(by=1)
|
@@ -63,7 +63,7 @@ module StreamParser
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def next_char
|
66
|
-
@source[@index
|
66
|
+
@source[@index]
|
67
67
|
end
|
68
68
|
|
69
69
|
def prev_char
|
@@ -103,4 +103,18 @@ module StreamParser
|
|
103
103
|
output
|
104
104
|
end
|
105
105
|
|
106
|
+
def quoted_value(quote_char = '"', escape_chars = ["\\"])
|
107
|
+
ret_value = ""
|
108
|
+
while scan_until(/(#{quote_char}|\Z)/)
|
109
|
+
if match != quote_char
|
110
|
+
raise Net::HTTPHeaderSyntaxError.new("Invalid Set-Cookie header format: unbalanced quotes (#{quote_char})")
|
111
|
+
elsif !escape_chars.include?(pre_match[-1])
|
112
|
+
ret_value << pre_match
|
113
|
+
return ret_value
|
114
|
+
else
|
115
|
+
ret_value << pre_match[0...-1] << match
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
106
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activesupport
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description:
|
98
112
|
email:
|
99
113
|
- jonbracy@gmail.com
|