Class: Aws::Crt::Http::Message
- Inherits:
-
Object
- Object
- Aws::Crt::Http::Message
show all
- Includes:
- ManagedNative
- Defined in:
- lib/aws-crt/http/message.rb
Overview
Instance Method Summary
collapse
included, #manage_native, #native, #native_set?, #release
Constructor Details
#initialize(method, path, headers = {}) ⇒ Message
Returns a new instance of Message.
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/aws-crt/http/message.rb', line 14
def initialize(method, path, = {})
strings = [method, path] +
.flatten
blob = StringBlob.encode(strings)
blob_ptr = FFI::MemoryPointer.new(:char, blob.length)
blob_ptr.write_array_of_char(blob)
manage_native do
Aws::Crt::Native.http_message_new_from_blob(blob_ptr, blob.length)
end
end
|
Instance Method Details
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/aws-crt/http/message.rb', line 32
def
blob_strings = to_blob_strings
if blob_strings.length < 2 ||
blob_strings.length.odd?
raise Aws::Crt::Errors::Error,
'Invalid blob_string for HTTP Message'
end
blob_strings[2..blob_strings.length].each_slice(2).to_h
end
|
#method ⇒ Object
44
45
46
|
# File 'lib/aws-crt/http/message.rb', line 44
def method
to_blob_strings[0]
end
|
#path ⇒ Object
48
49
50
|
# File 'lib/aws-crt/http/message.rb', line 48
def path
to_blob_strings[1]
end
|
#to_blob_strings ⇒ Object
26
27
28
29
30
|
# File 'lib/aws-crt/http/message.rb', line 26
def to_blob_strings
buf_out = Aws::Crt::Native::CrtBuf.new
Aws::Crt::Native.http_message_to_blob(native, buf_out)
StringBlob.decode(buf_out.to_blob)
end
|