Class: RFuzz::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/rfuzz/client.rb

Overview

This simple class can be registered with an HttpClient and it’ll get called when different parts of the HTTP request happen. Each function represents a different event, and the state parameter is a symbol of consisting of:

:begins -- event begins.
:error -- event caused exception.
:ends -- event finished (not called if error).

These calls are made synchronously so you can throttle the client by sleeping inside them and can track timing data.

Instance Method Summary collapse

Instance Method Details

#close(state) ⇒ Object

Before and after the client closes with the server.



504
505
# File 'lib/rfuzz/client.rb', line 504

def close(state)
end

#connect(state) ⇒ Object

Fired right before connecting and right after the connection.



480
481
# File 'lib/rfuzz/client.rb', line 480

def connect(state)
end

#read_body(state) ⇒ Object

Before and after the body is ready.



500
501
# File 'lib/rfuzz/client.rb', line 500

def read_body(state)
end

#read_chunk(state) ⇒ Object

Called when a chunk from a chunked encoding is read.



508
509
# File 'lib/rfuzz/client.rb', line 508

def read_chunk(state)
end

#read_header(state) ⇒ Object

Before and after the header is finally read.



496
497
# File 'lib/rfuzz/client.rb', line 496

def read_header(state)
end

#redirect(state) ⇒ Object

Called whenever a HttpClient.redirect is done and there are redirects to follow. You can use a notifier to detect that you’re doing to many and throw an abort.



492
493
# File 'lib/rfuzz/client.rb', line 492

def redirect(state)
end

#send_request(state) ⇒ Object

Before and after the full request is actually sent. This may become “send_header” and “send_body”, but right now the whole blob is shot out in one chunk for efficiency.



486
487
# File 'lib/rfuzz/client.rb', line 486

def send_request(state)
end