-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathwrk.sh
95 lines (88 loc) · 4.25 KB
/
wrk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
# Automatic generated, DON'T MODIFY IT.
# @option -c --connections <N> Connections to keep open
# @option -d --duration <T> Duration of test
# @option -t --threads <N> Number of threads to use
# @option -s --script <FILE> Load Lua script file
# @option -H --header*[`_module_http_header`] <H> Add header to request
# @flag --latency Print latency statistics
# @option --timeout <T> Socket/request timeout
# @flag -v --version Print version details
# @arg url!
. "$ARGC_COMPLETIONS_ROOT/utils/_argc_utils.sh"
_module_http_accept_encoding() {
command cat <<-'EOF'
br Brotli
compress UNIX 'compress' program method
deflate compression based on the deflate algorithm
exi W3C Efficient XML Interchange
gzip GNU zip format
identity No transformation is used.
pack200-gzip Network Transfer Format for Java Archives
zstd Zstandard compression
EOF
}
_module_http_cache_control() {
command cat <<-'EOF' | sed 's/=\t/=\x00\t/'
max-age= The maximum amount of time a resource is considered fresh.
max-stale Indicates the client will accept a stale response.
min-fresh= Indicates the client wants a response that will still be fresh for at least the specified number of seconds.
no-cache The response may be stored by any cache, even if the response is normally non-cacheable.
no-store The response may not be stored in any cache.
no-transform An intermediate cache or proxy cannot edit the response body.
only-if-cached Set by the client to indicate \"do not use the network\" for the response.
EOF
}
_module_http_header() {
command cat <<-'EOF' | _argc_util_comp_kv ${SEP:-:}
Accept=;;Media type(s) that is/are acceptable for the response. See Content negotiation.
Accept-Encoding=`_module_http_accept_encoding`;;List of acceptable encodings. See HTTP compression.
Accept-Language=;;List of acceptable human languages for response. See Content negotiation.
Access-Control-Request-Method=;;Initiates a request for cross-origin resource sharing with Origin
Access-Control-Request-Headers=;;Initiates a request for cross-origin resource sharing with Origin
Authorization=;;Authentication credentials for HTTP authentication.
Cache-Control=`_module_http_cache_control`;;Used to specify directives that must be obeyed by all caching mechanisms along the request-response chain.
Content-Type=`_module_http_media_type`;;The Media type of the body of the request (used with POST and PUT requests).
Cookie=;;An HTTP cookie previously sent by the server with Set-Cookie (below).
Date=;;The date and time at which the message was originated (in "HTTP-date" format as defined by RFC 7231 Date/Time Formats).
Expect=;;Indicates that particular server behaviors are required by the client.
Forwarded=;;Disclose original information of a client connecting to a web server through an HTTP proxy.[15]
Host=;;The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening.
Max-Forwards=;;Limit the number of times the message can be forwarded through proxies or gateways.
Origin=;;Initiates a request for cross-origin resource sharing (asks server for Access-Control-* response fields).
Pragma=;;Implementation-specific fields that may have various effects anywhere along the request-response chain.
Referer=;;This is the address of the previous web page from which a link to the currently requested page was followed.
Proxy-Authorization=;;Authorization credentials for connecting to a proxy.
Range=;;Request only part of an entity. Bytes are numbered from 0. See Byte serving.
Referer=;;This is the address of the previous web page from which a link to the currently requested page was followed.
Upgrade=;;Ask the server to upgrade to another protocol. Must not be used in HTTP/2.[13]
User-Agent=;;The user agent string of the user agent.
Via=;;Informs the server of proxies through which the request was sent.
EOF
}
_module_http_media_type() {
command cat <<-'EOF'
application/graphql
application/javascript
application/json
application/msword
application/pdf
application/sql
application/x-www-form-urlencoded
application/xml
application/zip
audio/mpeg
audio/ogg
image/gif
image/webp
image/jpeg
image/png
multipart/form-data
text/css
text/csv
text/html
text/plain
text/xml
EOF
}
command eval "$(argc --argc-eval "$0" "$@")"