| Age | Commit message (Collapse) | Author |
|
|
|
Go 1.22 now support for-range on numeric value.
|
|
|
|
For HTTP server that use TLS, set the minimum TLS version and
ReadHeaderTimeout to mitigate slowloris attack.
For HTTP client or server that parameterize the use of InsecureSkipVerify,
annotate the line with "nolint:gosec" to allow the code pass the check.
Library that still use sha1, in example in DKIM and TOTP, skip the
warnings by annotating the line with "nolint:gosec".
A pointer variable now allocated their address before assigning its
value.
Any error that returned now wrapped using "%w".
Also, replace error checking using [errors.Is] or [errors.As] instead of
using equal or not-equal operators.
In "lib/http", replace any usage of "math/rand" with "crypto/rand".
Any call of [math/big.Rat.SetString] now annotated with "nolint:gosec"
since its false positive, the issue has been fixed in Go >= 1.17.7.
Any switch case that does not cover the rest of the possible values now
handled by adding the cases or by replacing the "default" case with
the rest of values.
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
|
|
The realignment reduce the cost of the following struct,
* Client: from 24 to 16 bytes (-8)
* Response: from 64 to 48 bytes (-16)
* Value: from 40 to 32 bytes (-8)
|
|
|
|
The GetFieldAsBoolean return the struct's field value by its key as
bool type.
|
|
Previously, if GetFieldAsString is called and the struct field type is
not string, it will return "%s(<type>=<value>)" instead of the value
in string.
This commit fix this issue by using %v to convert non-string type.
|
|
Previously, the GetFieldAsString will return empty string if the
Value type is not string.
In this commit, we force the value to be string by converted it using
fmt.Sprintf.
|
|
This is to make sure that the returned value is not ignored with "_".
While at it, remove unused global constant `boolTrue`.
|
|
Previously, uint8 and uint16 will be converted as Double, but those
types are in range of four bytes so it can still be handled by int32.
|
|
The errors.E contains code and message that also implement wrapping and
unwrapping error, so we can use the Response as error just like in
http.EndpointResponse.
|
|
This is to make the Request or Response format consistent and to make
test working as expected.
|
|
Previously, for param with type "struct" is represented by slice of
Member{Name,Value}.
This commit changes the Value field for "struct" to a map of string and
value for easily access the struct's member, without looping.
|
|
This changes,
* method to parse XML-RPC request,
* change the Member field Value type to pointer to Value,
* change the Request field Params type to slice of pointer of Value,
* change the Response field Param type to pointer to Value,
* rename the Value fields from Members to StructMembers and Values to
ArrayValues
|
|
|
|
This package provide a client library for talking with XML-RPC server.
|