monitoring-plugins icon indicating copy to clipboard operation
monitoring-plugins copied to clipboard

check_curl: append the query string from parsed uri

Open inqrphl opened this issue 1 month ago • 9 comments

Check the UriUriA object, and if query string exists append it to the new_url.

Function redir parses the new location header value using the uriParseUriA function already, which populates the query field. This field was already being printed, but it was not being appended to the new_url during its construction.

Redirection chain of check_curl --onredirect=follow now mimics the chain of check_http --onredirect=follow. Tested on the url: mail.google.com/chat

Related issue #2192

inqrphl avatar Dec 04 '25 16:12 inqrphl

Thanks @inqrphl, looks good to me on a first glance. I will investigate whether there are repercussions we have to consider and maybe if we can put a testcase in for this. (The testcase would be most welcome, if you can think of one yourself)

RincewindsHat avatar Dec 07 '25 14:12 RincewindsHat

Thanks @RincewindsHat. Let me try writing up the tests for the change as well. From what I understand, there are two test files for check_curl, plugins/t and plugins/tests .

plugins/tests/check_curl runs its own perl http server, and will be probably easier to work than plugin/t/check_curl that needs apache running in the container and properly set testing variables.

inqrphl avatar Dec 08 '25 12:12 inqrphl

Wrote an additional endpoint called /redirect_with_increment to the integrated http server of plugins/tests/check_curl.t .

It parses the different fields of the uri, increments the value of the key/value pairs before redirecting.

If the check_curl does not properly parse and rebuild the uri, either when it first gets it, gets it from a 301 redirect with a new path, or from the Location header, it will be apparent.

With the current tests, I realized that it is not adding the fragment for example. The first GET request it does does not have the #f1=test at the end

./tests/check_curl.t .. 74/? 
#   Failed test 'Output correct, parsed and incremented fragment f1 : * curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl#f1=test
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 301 Moved Permanently
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# < Content-Type: text/plain
# * no chunk, no close, no size. Assume close to signal end
# < 
# * shutting down connection #0
# * curl CURLINFO_RESPONSE_CODE is 301
# **** HEADER ****
# HTTP/1.1 301 Moved Permanently
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# Content-Type: text/plain
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl
#  uri: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl
#  path: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab
#  query: qp1=10&qp2=kl
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=0;p1=1;p2=ab
#  parameter: redirect_count -> 0
#  parameter: p1 -> 1
#  parameter: p2 -> ab
#  query: qp1 -> 10
#  query: qp2 -> kl
#  parameter new: redirect_count -> 1
#  parameter new: p1 -> 2
#  parameter new: p2 -> bc
#  query parameter new: qp1 -> 11
#  query parameter new: qp2 -> lm
#  new_parameter_str: redirect_count=1;p1=2;p2=bc
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# 
# * Seen redirect location http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# ** scheme: http
# ** host: 127.0.0.1
# ** port: 50697
# ** IPv4: 127.0.0.1
# ** path: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc
# ** query: qp1=11&qp2=lm
# Redirection to http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# * curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 301 Moved Permanently
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# < Content-Type: text/plain
# * no chunk, no close, no size. Assume close to signal end
# < 
# * shutting down connection #0
# * curl CURLINFO_RESPONSE_CODE is 301
# **** HEADER ****
# HTTP/1.1 301 Moved Permanently
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# Content-Type: text/plain
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#  uri: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#  path: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc
#  query: qp1=11&qp2=lm
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=1;p1=2;p2=bc
#  parameter: redirect_count -> 1
#  parameter: p1 -> 2
#  parameter: p2 -> bc
#  query: qp1 -> 11
#  query: qp2 -> lm
#  parameter new: redirect_count -> 2
#  parameter new: p1 -> 3
#  parameter new: p2 -> cd
#  query parameter new: qp1 -> 12
#  query parameter new: qp2 -> mn
#  new_parameter_str: redirect_count=2;p1=3;p2=cd
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# 
# * Seen redirect location http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# ** scheme: http
# ** host: 127.0.0.1
# ** port: 50697
# ** IPv4: 127.0.0.1
# ** path: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd
# ** query: qp1=12&qp2=mn
# Redirection to http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# * curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 200 OK
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Content-Length: 790
# < 
# * Connection #0 to host 127.0.0.1 left intact
# * curl CURLINFO_RESPONSE_CODE is 200
# **** HEADER ****
# HTTP/1.1 200 OK
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Content-Length: 790
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#  uri: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#  path: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd
#  query: qp1=12&qp2=mn
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=2;p1=3;p2=cd
#  parameter: redirect_count -> 2
#  parameter: p1 -> 3
#  parameter: p2 -> cd
#  query: qp1 -> 12
#  query: qp2 -> mn
#  parameter new: redirect_count -> 3
#  parameter new: p1 -> 4
#  parameter new: p2 -> de
#  query parameter new: qp1 -> 13
#  query parameter new: qp2 -> no
#  new_parameter_str: redirect_count=3;p1=4;p2=de
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=3;p1=4;p2=de?qp1=13&qp2=no
# 
# [OK] - ok=1, warning=0, critical=0, unknown=0
#       \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl#f1=test
#               \_[OK] - HTTP/1.1 301 Moved Permanently - 1032 bytes in 0.001 second response time
#               \_[OK] - Total connection time: 0.000730s
#               \_[OK] - Status line output matched "HTTP/"
#               \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#                       \_[OK] - HTTP/1.1 301 Moved Permanently - 1032 bytes in 0.000 second response time
#                       \_[OK] - Total connection time: 0.000493s
#                       \_[OK] - Status line output matched "HTTP/"
#                       \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#                               \_[OK] - HTTP/1.1 200 OK - 900 bytes in 0.000 second response time
#                               \_[OK] - Total connection time: 0.000346s
#                               \_[OK] - Status line output matched "HTTP/"
#                               \_[OK] - HTTP return code: 200|'time'=0.000730s;;;  'time'=0.000493s;;;  'time'=0.000346s;;;  '
#   at ./tests/check_curl.t line 675.
#                   '* curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl#f1=test
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 301 Moved Permanently
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# < Content-Type: text/plain
# * no chunk, no close, no size. Assume close to signal end
# < 
# * shutting down connection #0
# * curl CURLINFO_RESPONSE_CODE is 301
# **** HEADER ****
# HTTP/1.1 301 Moved Permanently
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# Content-Type: text/plain
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl
#  uri: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl
#  path: /redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab
#  query: qp1=10&qp2=kl
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=0;p1=1;p2=ab
#  parameter: redirect_count -> 0
#  parameter: p1 -> 1
#  parameter: p2 -> ab
#  query: qp1 -> 10
#  query: qp2 -> kl
#  parameter new: redirect_count -> 1
#  parameter new: p1 -> 2
#  parameter new: p2 -> bc
#  query parameter new: qp1 -> 11
#  query parameter new: qp2 -> lm
#  new_parameter_str: redirect_count=1;p1=2;p2=bc
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# 
# * Seen redirect location http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# ** scheme: http
# ** host: 127.0.0.1
# ** port: 50697
# ** IPv4: 127.0.0.1
# ** path: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc
# ** query: qp1=11&qp2=lm
# Redirection to http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# * curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 301 Moved Permanently
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# < Content-Type: text/plain
# * no chunk, no close, no size. Assume close to signal end
# < 
# * shutting down connection #0
# * curl CURLINFO_RESPONSE_CODE is 301
# **** HEADER ****
# HTTP/1.1 301 Moved Permanently
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Location: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# Content-Type: text/plain
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#  uri: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#  path: /redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc
#  query: qp1=11&qp2=lm
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=1;p1=2;p2=bc
#  parameter: redirect_count -> 1
#  parameter: p1 -> 2
#  parameter: p2 -> bc
#  query: qp1 -> 11
#  query: qp2 -> lm
#  parameter new: redirect_count -> 2
#  parameter new: p1 -> 3
#  parameter new: p2 -> cd
#  query parameter new: qp1 -> 12
#  query parameter new: qp2 -> mn
#  new_parameter_str: redirect_count=2;p1=3;p2=cd
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# 
# * Seen redirect location http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# ** scheme: http
# ** host: 127.0.0.1
# ** port: 50697
# ** IPv4: 127.0.0.1
# ** path: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd
# ** query: qp1=12&qp2=mn
# Redirection to http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# * curl CURLOPT_URL: http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
# * SSL library string is : OpenSSL/3.5.4 OpenSSL (1)
# *   Trying 127.0.0.1:50697...
# * Connected to 127.0.0.1 (127.0.0.1) port 50697
# * using HTTP/1.x
# > GET /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn HTTP/1.1
# Host: 127.0.0.1:50697
# User-Agent: check_curl/v2.4.0.878.ge0b30 (monitoring-plugins 2.4git, libcurl/8.14.1 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10)
# Accept: */*
# Connection: close
# 
# * Request completely sent off
# < HTTP/1.1 200 OK
# < Date: Mon, 08 Dec 2025 23:18:06 GMT
# < Server: libwww-perl-daemon/1.00
# < Content-Length: 790
# < 
# * Connection #0 to host 127.0.0.1 left intact
# * curl CURLINFO_RESPONSE_CODE is 200
# **** HEADER ****
# HTTP/1.1 200 OK
# Date: Mon, 08 Dec 2025 23:18:06 GMT
# Server: libwww-perl-daemon/1.00
# Content-Length: 790
# 
# 
# **** CONTENT ****
#  original_url: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#  uri: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#  path: /redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd
#  query: qp1=12&qp2=mn
#  fragment: 
#  before_params: /redirect_with_increment/path1/path2
#  params: redirect_count=2;p1=3;p2=cd
#  parameter: redirect_count -> 2
#  parameter: p1 -> 3
#  parameter: p2 -> cd
#  query: qp1 -> 12
#  query: qp2 -> mn
#  parameter new: redirect_count -> 3
#  parameter new: p1 -> 4
#  parameter new: p2 -> de
#  query parameter new: qp1 -> 13
#  query parameter new: qp2 -> no
#  new_parameter_str: redirect_count=3;p1=4;p2=de
#  new_fragment_str: 
#  new_uri: /redirect_with_increment/path1/path2;redirect_count=3;p1=4;p2=de?qp1=13&qp2=no
# 
# [OK] - ok=1, warning=0, critical=0, unknown=0
#       \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=0;p1=1;p2=ab?qp1=10&qp2=kl#f1=test
#               \_[OK] - HTTP/1.1 301 Moved Permanently - 1032 bytes in 0.001 second response time
#               \_[OK] - Total connection time: 0.000730s
#               \_[OK] - Status line output matched "HTTP/"
#               \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=1;p1=2;p2=bc?qp1=11&qp2=lm
#                       \_[OK] - HTTP/1.1 301 Moved Permanently - 1032 bytes in 0.000 second response time
#                       \_[OK] - Total connection time: 0.000493s
#                       \_[OK] - Status line output matched "HTTP/"
#                       \_[OK] - Testing http://127.0.0.1:50697/redirect_with_increment/path1/path2;redirect_count=2;p1=3;p2=cd?qp1=12&qp2=mn
#                               \_[OK] - HTTP/1.1 200 OK - 900 bytes in 0.000 second response time
#                               \_[OK] - Total connection time: 0.000346s
#                               \_[OK] - Status line output matched "HTTP/"
#                               \_[OK] - HTTP return code: 200|'time'=0.000730s;;;  'time'=0.000493s;;;  'time'=0.000346s;;;  '
#     doesn't match '/.*#f1=vguv*/'

inqrphl avatar Dec 08 '25 23:12 inqrphl

Ran the spellcheck action on my own repo after pushing the typo fix, should be ok now.

inqrphl avatar Dec 10 '25 16:12 inqrphl

hm, maybe I am misunderstanding the functionality here, but where does the vguv in the tests come from?

RincewindsHat avatar Dec 10 '25 23:12 RincewindsHat

The fragment had a single key/value pair, f1=test. The endpoint increments each character/integer value it encounters, until redirect_count value is 3. It starts at 0 in all test cases. I added some more comments to each test case that explains what the server does.

So the value was changed like this during the redirect. "test" -> "uftu" -> "vguv" => "whvw" . And tests look if the output contains the incremented values, which should happen if the check_curl properly follows without dropping parts of the URI.

The redirects are printed at the end of the check, but the last redirect link returns OK and does not print the full URI. I was using the second-to-last URI which is visible by default at the end for my tests.

I switched the tests so that they use the parameters in the last one instead. This might be easier to understand since redirect_count value and other values are all incremented by 3.

inqrphl avatar Dec 11 '25 09:12 inqrphl

The url fragment / hash should never be sent to the http server. It can be part of a redirect when sent to the client, but should never be part of an url sent to the server.

sni avatar Dec 11 '25 10:12 sni

I rewrote the server endpoint so that it checks if you passed a parameter named "fragment", and redirects you to it. Client should acknowledge the fragments internally and take action, like scrolling to the section with that fragment name if its a browser.

The fragment test now just checks if the client is receiving a redirection URI with fragments from the server. It should be redirected three times in total, and the last time the fragment becomes string "hello" .

Removed unused code, removed the -p $http_port so that new tests do not fail on https server, adjusted the common test count so that the planned tests match the ran tests which stops the testing framework from complaining.

$ perl -I .. -I .. ../test.pl ./tests/check_curl.t 
./tests/check_curl.t .. ok     
All tests successful.
Files=1, Tests=210, 21 wallclock secs ( 0.08 usr  0.01 sys +  0.68 cusr  0.52 csys =  1.29 CPU)
Result: PASS

inqrphl avatar Dec 12 '25 10:12 inqrphl

looks good to me. The failed test seems unrelated.

sni avatar Dec 18 '25 08:12 sni