Skip to content

Commit e1aa759

Browse files
committed
Instrument content length from read_ber
1 parent 4884bff commit e1aa759

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/net/ber/ber_parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def read_ber(syntax = nil)
160160
if -1 == content_length
161161
raise Net::BER::BerError, "Indeterminite BER content length not implemented."
162162
else
163+
yield id, content_length if block_given?
163164
data = read(content_length)
164165
end
165166

lib/net/ldap.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,11 @@ def close
12681268
end
12691269

12701270
def read(syntax = Net::LDAP::AsnSyntax)
1271-
instrument "read.net_ldap_connection", :syntax => syntax do
1272-
@conn.read_ber(syntax)
1271+
instrument "read.net_ldap_connection", :syntax => syntax do |payload|
1272+
@conn.read_ber(syntax) do |id, content_length|
1273+
payload[:response_id] = id
1274+
payload[:content_length] = content_length
1275+
end
12731276
end
12741277
end
12751278
private :read

0 commit comments

Comments
 (0)