Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{c,cc,cpp,h,hpp}]
indent_style = space
indent_size = 4

[*.{sma,inc}]
indent_style = space
indent_size = 4

[CMakeLists.txt]
indent_style = space
indent_size = 4

[*.cmake]
indent_style = space
indent_size = 4
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ add_subdirectory(src)

if (GCC)
target_compile_options(cpr PRIVATE
-Wno-attribute-warning
-Wno-error=attribute-warning
)
endif ()
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public http_complete(EzHttpRequest:request_id)
ezhttp_save_data_to_file(request_id, fmt("addons/amxmodx/response_%d.json", request_id))
}

// ezhttp_create_options() now uses auto_destroy = true by default.
// The handle is cleaned up automatically after the last request using it finishes.
// If you want to keep the same options handle alive for later reuse, create it like this:
//
// new EzHttpOptions:reusable = ezhttp_create_options(.auto_destroy = false)
// ...
// ezhttp_destroy_options(reusable)

// --------------------------------------------------------------------

public ftp_upload()
Expand Down
13 changes: 12 additions & 1 deletion amxx/scripting/include/easy_http.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ enum EzHttpPluginEndBehaviour
* Creates new options object. This object allows you to configure your request by specifying
* such parameters as user agent, query parameters, headers, and etc.
* Options are reusable request templates. Their values are copied into a request when it is sent.
* By default the options handle is destroyed automatically when the last request using it finishes.
*
* @param auto_destroy When true, the handle is released automatically after it becomes idle.
* Set to false when you want to keep reusing the same handle across
* multiple request lifecycles and destroy it manually later.
*
* @return EzHttpOptions handle.
*/
native EzHttpOptions:ezhttp_create_options();
native EzHttpOptions:ezhttp_create_options(bool:auto_destroy = true);

/**
* Destroys an options object previously created via ezhttp_create_options().
* It is safe to destroy an options object after sending a request because the request keeps its own snapshot.
* This is mainly useful when ezhttp_create_options(.auto_destroy = false) was used or when you want eager cleanup.
*
* @param options_id Options identifier created via ezhttp_create_options().
*
Expand Down Expand Up @@ -235,6 +241,7 @@ native ezhttp_option_set_user_data(EzHttpOptions:options_id, const data[], len);
* * EZH_CANCEL_REQUEST to cancel the request;
* * EZH_FORGET_REQUEST to complete the request, but ignore its result
* (callback will not be called).
* Passing any other value raises a native error.
*
* @noreturn
*/
Expand Down Expand Up @@ -578,6 +585,7 @@ native ezhttp_get_user_data(EzHttpRequest:request_id, data[]);
* @param on_complete The function to call when the upload is complete.
* Signature: public on_complete(EzHttpRequest:request_id)
* @param security Member of EzHttpFtpSecurity. The security strategy use for the FTP connection.
* Passing any other value raises a native error.
* @param options_id The options to use for the request.
*
* @return The request handle.
Expand All @@ -601,6 +609,7 @@ native EzHttpRequest:ezhttp_ftp_upload(
* @param on_complete The function to call when the upload is complete.
* Signature: public on_complete(EzHttpRequest:request_id)
* @param security Member of EzHttpFtpSecurity. The security strategy use for the FTP connection.
* Passing any other value raises a native error.
* @param options_id The options to use for the request.
*
* @return The request handle.
Expand All @@ -625,6 +634,7 @@ native EzHttpRequest:ezhttp_ftp_upload2(
* @param on_complete The function to call when the download is complete.
* Signature: public on_complete(EzHttpRequest:request_id)
* @param security Member of EzHttpFtpSecurity. The security strategy use for the FTP connection.
* Passing any other value raises a native error.
* @param options_id The options to use for the request.
*
* @return The request handle.
Expand All @@ -650,6 +660,7 @@ native EzHttpRequest:ezhttp_ftp_download(
* @param on_complete The function to call when the download is complete.
* Signature: public on_complete(EzHttpRequest:request_id)
* @param security Member of EzHttpFtpSecurity. The security strategy use for the FTP connection.
* Passing any other value raises a native error.
* @param options_id The options to use for the request.
*
* @return The request handle.
Expand Down
Loading
Loading