HTTP Module Events
http_data_send
Notifies about ready to send the next portion of data of request. max_data_length contains the maximum number of bytes which can be sent now for current script execution.
This event will be received after establishing connection with HTTP server and if last field was false in http.request() or http.repeat_request() methods. Also, this event can be triggered again if not all data sent in this session.
Name | Type | Required | Description |
---|---|---|---|
id | string | + | Unique ID of request |
url | string | + | Full url for making connection( can contain custom port ) |
user_data | string | - | User data which was passed to http.request() call. |
max_data_length | int | + | Size of data which can be send peer one script execution via http.send_data() method |
http_data_received
Notifies about the answer on request or new portion of data. It triggers when "receiving data buffer" is full or all bytes was received (according to Content-Length header ) or two end lines were received. When caching was disabled, it triggers immediately after new portion of data was received
Name | Type | Required | Description |
---|---|---|---|
id | string | + | Unique ID of request |
url | string | + | Full url for making connection( can contain custom port ) |
code | int | + | HTTP request return code |
headers | array of objects | - | Response request headers |
headers.key | string | + | Name of header record |
headers.value | string | + | Value of header record |
user_data | string | - | User data which was passed to http.request() call. |
data | string | + | Size of data which can be sent peer one script execution for this connection |
last | bool | - | Last part of HTTP data request. If all bytes was received( according to Content-Length header ) or two end lines were received than this field should be true, in all other cases false. |
http_connection_closed
Name | Type | Required | Description |
---|---|---|---|
id | string | + | Unique ID of request |
url | string | + | Full url for making connection( can contain custom port ) |
user_data | string | - | User data which was passed to http.request() call. |
reason | object | + | |
reason.code | int | + | Code of reason |
reason.text | string | + | Text of reason |
Reasons:
Code | Text |
---|---|
1 | Cannot resolve DNS name |
2 | Cannot connect to the server |
3 | SSL Connection Error |
4 | Closed by client |
5 | Closed by server |
6 | Timeout of response is reached |
7 | Unknown error |