sibylline-scurl 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sibylline-scurl
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A secure curl wrapper with middleware support and HTML-to-markdown extraction
5
5
  Author: Nathan
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sibylline-scurl"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "A secure curl wrapper with middleware support and HTML-to-markdown extraction"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,3 +1,3 @@
1
1
  """scurl - A secure curl wrapper with middleware support."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
@@ -32,10 +32,16 @@ def parse_curl_args(args: list[str]) -> RequestContext:
32
32
  arg = args[i]
33
33
 
34
34
  # URL (positional or after flags)
35
+ # Accept URLs with scheme or bare hostnames (like curl does)
35
36
  if arg.startswith("http://") or arg.startswith("https://"):
36
37
  url = arg
37
38
  i += 1
38
39
  continue
40
+ elif not arg.startswith("-") and ("." in arg or arg.startswith("localhost")) and not url:
41
+ # Bare hostname without scheme - curl defaults to http
42
+ url = arg
43
+ i += 1
44
+ continue
39
45
 
40
46
  # Method
41
47
  if arg in ("-X", "--request"):
@@ -139,6 +139,22 @@ class TestParseCurlArgs:
139
139
  assert ctx.headers == {}
140
140
  assert ctx.body is None
141
141
 
142
+ def test_bare_hostname(self):
143
+ """Bare hostname without scheme should be accepted like curl."""
144
+ ctx = parse_curl_args(["www.google.com"])
145
+
146
+ assert ctx.url == "www.google.com"
147
+
148
+ def test_bare_hostname_with_path(self):
149
+ ctx = parse_curl_args(["example.com/path/to/page"])
150
+
151
+ assert ctx.url == "example.com/path/to/page"
152
+
153
+ def test_localhost(self):
154
+ ctx = parse_curl_args(["localhost:8080"])
155
+
156
+ assert ctx.url == "localhost:8080"
157
+
142
158
  def test_unknown_flags_preserved(self):
143
159
  """Unknown flags should be preserved in curl_args for pass-through."""
144
160
  args = ["-v", "--compressed", "-L", "https://example.com"]