aboutsummaryrefslogtreecommitdiff
path: root/lib/http/http_example_test.go
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2021-07-30lib/http: add missing license headerShulhan
2021-02-10http: change signature of IPAddressOfRequestShulhan
Previously, the IPAddressOfRequest accept only one parameter, the http.Request. This make the function only works on HTTP server from standard library, not from other library (for example websocket) or other protocol that use HTTP header too. This commit changes the parameter to http.Header and default address. If no headers present, then the default address will be used.
2021-02-07http: add methods IPAddressOfRequest and ParseXForwardedForShulhan
The IPAddressOfRequest get the client IP address from HTTP request header "X-Real-IP" or "X-Forwarded-For" or from Request.RemoteAddr, which ever non-empty first. The ParseXForwardedFor parse the HTTP header "X-Forwarded-For" value from the following format "client, proxy1, proxy2" into client address and list of proxy addressess.