Skip to content

curl: support the options that the Strands harness web_fetch uses #130

Closed

Description

@ferdingler

The curl builtin refuses several options that the Strands harness web_fetch tool sends, so web_fetch cannot run on Strands Shell. It sends (web_fetch.py#L74-L85):

curl -sSL -g --fail --proto '=http,https' --proto-redir '=http,https' --max-time N -A <ua> -o <out> -w '%{content_type}\n%{url_effective}' -- <url>
Item Real curl Builtin today
-g, --globoff Does not expand {} / [] in the URL Refused (the builtin never expands them, so this can be a no-op)
--proto <list> Permits only the listed protocols Refused
--proto-redir <list> Permits only the listed protocols on a redirect Refused
-m, --max-time <s> Bounds the whole transfer, exit 28 Refused
-A, --user-agent <ua> Sets User-Agent Refused
-w '%{content_type}' The response Content-Type Always empty
-w '%{url_effective}' The last URL after redirects Written literally

Related: a Location: ftp://… redirect is resolved as a relative path (<base>/ftp://…) because only http:// / https:// count as absolute, so --proto-redir could never see it.

--proto and --proto-redir only narrow what the request may do; the kernel's URL checks still decide every request.

I have a patch confined to src/commands/curl.rs with integration tests for each item and will open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Language

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions