curl/var: change byte offset syntax for assignments

Follow-up to 40c264db61 after discussions on IRC.

The new style is

  name[0-99]=contents

and

  name[0-99]@filename

A) This does not cause the same problems with old curl versions trying
the new syntax as this way will cause old curls just fail with syntax
error and not risk using the wrong file.

B) Adds the same byte range support for "normal" assigns, which the
previous syntax did not. Thus lets a user get a partial content of a
variable etc.

Added test 790 and 791 to verify non-file assigns with ranges.

Closes #15862
This commit is contained in:
Daniel Stenberg 2024-12-30 13:17:39 +01:00
parent e7b90dadb2
commit c2d37463b9
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 167 additions and 42 deletions

View file

@ -35,7 +35,7 @@ http
--variable with a file byte range, reading from stdin
</name>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --variable name"@-;[5-15]" --expand-data '{{name}}'
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --variable "name[5-15]@-" --expand-data '{{name}}'
</command>
<stdin>
On the first Monday of the month of April, 1625, the market town of Meung