mirror of
https://github.com/httpie/cli.git
synced 2025-08-18 01:31:10 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5b604c37c6 | ||
|
2843b874c6 | ||
|
2105caa49b | ||
|
8560d1196d | ||
|
2ef4a57d8c | ||
|
ff742581f4 | ||
|
fd30c4ef62 | ||
|
cee82c825e | ||
|
9eb8699873 | ||
|
3037327410 | ||
|
50e1564600 | ||
|
f4cf43ecdd |
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
os: [ubuntu-latest, macos-13, windows-latest]
|
||||
python-version:
|
||||
- '3.12'
|
||||
- '3.11'
|
||||
|
@@ -3,9 +3,13 @@
|
||||
This document records all notable changes to [HTTPie](https://httpie.io).
|
||||
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [3.2.4](https://github.com/httpie/cli/compare/3.2.3...3.2.4) (2024-11-01)
|
||||
|
||||
- Fix default certs loading and unpin `requests`. ([#1596](https://github.com/httpie/cli/issues/1596))
|
||||
|
||||
## [3.2.3](https://github.com/httpie/cli/compare/3.2.2...3.2.3) (2024-07-10)
|
||||
|
||||
- Fix SSL connections by pinning the `requests` version to `2.31.0`. ([#1583], [#1581])
|
||||
- Fix SSL connections by pinning the `requests` version to `2.31.0`. (#1583, #1581)
|
||||
- Make it possible to [unset](https://httpie.io/docs/cli/default-request-headers) the `User-Agent` and `Accept-Encoding` request headers. ([#1502](https://github.com/httpie/cli/issues/1502))
|
||||
|
||||
## [3.2.2](https://github.com/httpie/cli/compare/3.2.1...3.2.2) (2023-05-19)
|
||||
|
@@ -574,7 +574,7 @@ $ http PUT pie.dev/put \
|
||||
| HTTP Headers `Name:Value` | Arbitrary HTTP header, e.g. `X-API-Token:123` |
|
||||
| URL parameters `name==value` | Appends the given name/value pair as a querystring parameter to the URL. The `==` separator is used. |
|
||||
| Data Fields `field=value` | Request data fields to be serialized as a JSON object (default), to be form-encoded (with `--form, -f`), or to be serialized as `multipart/form-data` (with `--multipart`) |
|
||||
| Raw JSON fields `field:=json` | Useful when sending JSON and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:=[1,2,3]` (note the quotes) |
|
||||
| Raw JSON fields `field:=json` | Useful when sending JSON and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:='[1,2,3]'` (note the quotes) |
|
||||
| File upload fields `field@/dir/file`, `field@file;type=mime` | Only available with `--form`, `-f` and `--multipart`. For example `screenshot@~/Pictures/img.png`, or `'cv@cv.txt;type=text/markdown'`. With `--form`, the presence of a file field results in a `--multipart` request |
|
||||
|
||||
Note that the structured data fields aren’t the only way to specify request data:
|
||||
@@ -1044,7 +1044,7 @@ $ http POST pie.dev/post < files/data.json
|
||||
```bash
|
||||
$ http -f POST pie.dev/post name='John Smith' cv@~/files/data.xml
|
||||
```
|
||||
|
||||
|
||||
The request above is the same as if the following HTML form were submitted:
|
||||
|
||||
```html
|
||||
@@ -2568,7 +2568,7 @@ HTTPie plays exceptionally well with the following tools:
|
||||
|
||||
BSD-3-Clause: [LICENSE](https://github.com/httpie/cli/blob/master/LICENSE).
|
||||
|
||||
### Authors
|
||||
### Authors
|
||||
|
||||
[Jakub Roztocil](https://roztocil.co) ([@jakubroztocil](https://twitter.com/jakubroztocil)) created HTTPie and [these fine people](https://github.com/httpie/cli/blob/master/AUTHORS.md) have contributed.
|
||||
|
||||
|
@@ -112,3 +112,8 @@ complete -c http -l version -d 'Show version'
|
||||
complete -c http -l traceback -d 'Prints exception traceback should one occur'
|
||||
complete -c http -l default-scheme -x -d 'The default scheme to use'
|
||||
complete -c http -l debug -d 'Show debugging output'
|
||||
|
||||
|
||||
# Alias for https to http
|
||||
|
||||
complete -c https -w http
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py.
|
||||
.TH http 1 "2024-07-10" "HTTPie 3.2.3" "HTTPie Manual"
|
||||
.TH http 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
http
|
||||
.SH SYNOPSIS
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/manager/cli.py by extras/scripts/generate_man_pages.py.
|
||||
.TH httpie 1 "2024-07-10" "HTTPie 3.2.3" "HTTPie Manual"
|
||||
.TH httpie 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
httpie
|
||||
.SH SYNOPSIS
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py.
|
||||
.TH https 1 "2024-07-10" "HTTPie 3.2.3" "HTTPie Manual"
|
||||
.TH https 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
https
|
||||
.SH SYNOPSIS
|
||||
|
@@ -3,7 +3,7 @@ HTTPie: modern, user-friendly command-line HTTP client for the API era.
|
||||
|
||||
"""
|
||||
|
||||
__version__ = '3.2.3'
|
||||
__date__ = '2024-07-10'
|
||||
__version__ = '3.2.4'
|
||||
__date__ = '2024-11-01'
|
||||
__author__ = 'Jakub Roztocil'
|
||||
__licence__ = 'BSD'
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import sys
|
||||
from ssl import SSLContext
|
||||
from typing import Any, Optional, Iterable
|
||||
|
||||
from httpie.cookies import HTTPieCookiePolicy
|
||||
from http import cookiejar # noqa
|
||||
from http import cookiejar # noqa
|
||||
|
||||
|
||||
# Request does not carry the original policy attached to the
|
||||
@@ -10,7 +11,6 @@ from http import cookiejar # noqa
|
||||
# policy. <https://github.com/psf/requests/issues/5449>
|
||||
cookiejar.DefaultCookiePolicy = HTTPieCookiePolicy
|
||||
|
||||
|
||||
is_windows = 'win32' in str(sys.platform).lower()
|
||||
is_frozen = getattr(sys, 'frozen', False)
|
||||
|
||||
@@ -66,7 +66,6 @@ except ImportError:
|
||||
res = instance.__dict__[self.name] = self.func(instance)
|
||||
return res
|
||||
|
||||
|
||||
# importlib_metadata was a provisional module, so the APIs changed quite a few times
|
||||
# between 3.8-3.10. It was also not included in the standard library until 3.8, so
|
||||
# we install the backport for <3.8.
|
||||
@@ -100,3 +99,15 @@ def get_dist_name(entry_point: importlib_metadata.EntryPoint) -> Optional[str]:
|
||||
return None
|
||||
else:
|
||||
return metadata.get('name')
|
||||
|
||||
|
||||
def ensure_default_certs_loaded(ssl_context: SSLContext) -> None:
|
||||
"""
|
||||
Workaround for a bug in Requests 2.32.3
|
||||
|
||||
See <https://github.com/httpie/cli/issues/1583>
|
||||
|
||||
"""
|
||||
if hasattr(ssl_context, 'load_default_certs'):
|
||||
if not ssl_context.get_ca_certs():
|
||||
ssl_context.load_default_certs()
|
||||
|
@@ -1,13 +1,15 @@
|
||||
import ssl
|
||||
from typing import NamedTuple, Optional
|
||||
|
||||
from httpie.adapters import HTTPAdapter
|
||||
# noinspection PyPackageRequirements
|
||||
from urllib3.util.ssl_ import (
|
||||
create_urllib3_context,
|
||||
resolve_ssl_version,
|
||||
)
|
||||
|
||||
from .adapters import HTTPAdapter
|
||||
from .compat import ensure_default_certs_loaded
|
||||
|
||||
|
||||
SSL_VERSION_ARG_MAPPING = {
|
||||
'ssl2.3': 'PROTOCOL_SSLv23',
|
||||
@@ -32,7 +34,7 @@ class HTTPieCertificate(NamedTuple):
|
||||
def to_raw_cert(self):
|
||||
"""Synthesize a requests-compatible (2-item tuple of cert and key file)
|
||||
object from HTTPie's internal representation of a certificate."""
|
||||
return (self.cert_file, self.key_file)
|
||||
return self.cert_file, self.key_file
|
||||
|
||||
|
||||
class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
@@ -71,7 +73,7 @@ class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
ssl_version: str = None,
|
||||
ciphers: str = None,
|
||||
) -> 'ssl.SSLContext':
|
||||
return create_urllib3_context(
|
||||
ssl_context = create_urllib3_context(
|
||||
ciphers=ciphers,
|
||||
ssl_version=resolve_ssl_version(ssl_version),
|
||||
# Since we are using a custom SSL context, we need to pass this
|
||||
@@ -79,6 +81,8 @@ class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
# in `super().cert_verify()`.
|
||||
cert_reqs=ssl.CERT_REQUIRED if verify else ssl.CERT_NONE
|
||||
)
|
||||
ensure_default_certs_loaded(ssl_context)
|
||||
return ssl_context
|
||||
|
||||
@classmethod
|
||||
def get_default_ciphers_names(cls):
|
||||
|
Reference in New Issue
Block a user