Commit Graph

1471 Commits

Author SHA1 Message Date
Jakub Roztocil
7734e47280
Update README.md 2021-09-10 11:17:10 +02:00
Mickaël Schoentgen
30c595b770 [snap] Comment out the problematic interface
It seems it just needs to be present for the snap to be rejected.
2021-09-10 11:04:57 +02:00
Mickaël Schoentgen
b38352858f [snap] Remove personal-files interface
Use of the `personal-files` interface is reserved for vetted publishers.

The interface requires a validation, but we need to publish at least
one package first. So let's skip that part, release a version and ask
for the interface access in a second time.

Also add a workflow to build & test the snap package.
2021-09-10 10:30:44 +02:00
Mickaël Schoentgen
a45b94fda6 Complete CentOS installation instructions 2021-09-09 16:38:36 +02:00
Mickaël Schoentgen
513e5080e4 Add the release workflow
It has to be triggered manually for now.
2021-09-09 16:13:13 +02:00
Mickaël Schoentgen
7c9f415107
Add a workflow to check documentations (#1151)
* Add a workflow to check documentations

* Fix markdown issues

* Install Ruby 2.7

* Finally, handle and fix GitHub templates

* Minor improvement in the feature request template

* Verbose mode to be sure all files are checked
2021-09-09 15:52:24 +02:00
Mickaël Schoentgen
4c8633c6e5
Split the monolithic workflow into specific ones (#1149)
* Split the monolithic workflow into specific ones

* Rename workflows, improve commands

* Update pip from the venv

* Fix Windows setup

* Lowercase macos-latest

* Fix Windows run, again
2021-09-08 16:41:55 +02:00
Mickaël Schoentgen
4d7d6b66cf Trigger official documentation build when documentation is updated here 2021-09-08 15:43:34 +02:00
Mickaël Schoentgen
a586fca246
Update brew formula to 2.5.0 (#1144)
* Update brew formula to 2.5.0

* Can use `idna` 3.2

* Sort requirements to ease reproductible builds

And also to have the same output as `brew bump-formula-pr`.

* Sync `bottles` with official Formula

And keep the `high_sierra` one.

* Add a workflow to check the Formula
2021-09-08 11:01:27 +02:00
Mickaël Schoentgen
978258ec5b
Add Alpine Linux installation instructions 2021-09-08 10:04:49 +02:00
Omer Akram
84ef9f588c
Use lzo compression for snap (#1146) 2021-09-07 16:57:05 +02:00
Mickaël Schoentgen
cf21790411 Add the Snap build file for general Linux packaging
Based on the work of @elopio and @chipaca.

- Added support for the `snapd` protocol URL.
- Packaged Unix socket transport plugin.
2021-09-07 16:45:57 +02:00
Miro Hrončok
1ef127c61d Packit: Get the current Fedora Rawhide specfile
Using the fork is not needed anymore,
since Rawhide was updated to 2.5.0 and no longer has patches.
2021-09-07 11:03:04 +02:00
Mickaël Schoentgen
4eaa4d67c5
v2.5.0 (#1140)
[skip ci]
2021-09-06 20:23:14 +02:00
Jakub Roztocil
9764cc74a4 Cleanup 2021-09-06 20:23:00 +02:00
Jakub Roztocil
778360cde1 Cleanup 2021-09-06 20:21:49 +02:00
Jakub Roztocil
60a7ed4e7b Cleanup 2021-09-06 20:21:09 +02:00
Jakub Roztocil
185af7c9f1 Cleanup 2021-09-06 20:20:30 +02:00
Jakub Roztocil
7e9e7c783f
Readme tweaks (#1141) 2021-09-06 20:17:21 +02:00
Mickaël Schoentgen
6039bd8582
Switch from reStructuredText to Markdown and add docs/ (#1139)
* Convert most of the documentation from the frontend `README.rst` to `docs/REAME.md`

Also converted all reStructuredText files to Markdown.

* Tell `mdformat` to use LF for end on lines

* `--check` is not needed in the help message

* Skip tests on GitHub Windows.

Those tests pass on a real Windows machine.
Let's revisit those failure later, if needed.

* Move `mdoformat` requirement from `test` to `dev` extra

To fix Fedora CI.
2021-09-06 17:36:13 +02:00
a1346054
e7d8b9cece
Spelling and bash completion fixes (#1137)
* Remove hashbang from bash completion

Completion files are not supposed to have a hashbang.
They are sourced, not executed.

* Fix spelling

* Trim excess whitespace
2021-09-03 15:05:03 +02:00
Mickaël Schoentgen
a62391e789
Tiny clean-up in program() (#1135) 2021-09-02 16:47:01 +02:00
Jakub Roztocil
41666d897f
Update CHANGELOG.rst 2021-09-02 10:37:14 +02:00
Mickaël Schoentgen
71008bbedb Move example URL in a global variable for XML tests 2021-09-01 16:56:23 +02:00
Mickaël Schoentgen
85110643e7 Move example URL in a global variable for tests 2021-09-01 16:52:10 +02:00
Mickaël Schoentgen
fdd486415a Fix XML formatter tests 2021-09-01 10:28:03 +02:00
Jakub Roztocil
6c501d23c3 Change default XML indent to 2 spaces 2021-08-31 22:52:16 +02:00
Mickaël Schoentgen
d10e108b5f
Added support for XML formatting (#1129)
As a side effect, XHTML responses will be pretty-printed too.
2021-08-31 22:49:53 +02:00
Jakub Roztocil
8618f12fce Tweak format options docs 2021-08-24 17:18:45 +02:00
Mickaël Schoentgen
dac0d716c1
Add the formatting options section in the docs (#1131)
It will ease future changes and should improve reading/finding information.
2021-08-24 17:11:40 +02:00
Mickaël Schoentgen
0340f8caf5 Fix missing links in the changelog
[skip ci]
2021-08-17 11:21:04 +02:00
Mickaël Schoentgen
d7caeaf372
Fix handling of session files with Cookie: followed by other headers (#1127)
* Fix the handling of cookies from session files

* Apply suggestions from code review

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Fix test docstring formatting

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-08-16 14:50:46 +02:00
Mickaël Schoentgen
54c8612452
Remove unused code in BasicConfig (#1123) 2021-08-06 18:04:08 +02:00
Mickaël Schoentgen
4ff22defe4
Rework __main__.py to follow best practices (#1124)
It also simplifies how the `main()` function could be tested.
2021-08-06 16:57:19 +02:00
Mickaël Schoentgen
c50e287c57
CI: Run tests on Python 3.10 RC1 (#1121) 2021-08-06 13:11:21 +02:00
Mickaël Schoentgen
6bd6648545
Simplify get_content_type() (#1125)
We were using the potential `encoding` returned by `mimetypes.guess_type()`
to expand the `Content-Type` header.
According to the RFC-7231 [1] the `Content-Type` should contain a charset
and nothing more. But as stated in the `mimetypes.guess_type()` doc [2],
the `encoding` would be the name of the program used to encode (e.g. compress
or gzip) the payload. The `encoding` is suitable for use as a `Content-Encoding`
header. See [3] for potential `encoding`s, none is a IANA registered one [4], and
so a valid charset to be used by the `Content-Type` header.

[1] https://httpwg.org/specs/rfc7231.html#header.content-type
[2] https://docs.python.org/3/library/mimetypes.html#guess_type
[3] 938e84b4fa/Lib/mimetypes.py (L416-L422)
[4] https://www.iana.org/assignments/character-sets/character-sets.xhtml
2021-08-06 12:35:38 +02:00
Jakub Roztocil
6633b5ae9b Use UTF8 constant in FORM_CONTENT_TYPE as well 2021-08-05 21:00:17 +02:00
Mickaël Schoentgen
c6cbc7dfa5
Uniformize UTF-8 naming (#1115)
* Uniformize UTF-8 naming

Replace `utf8` -> `utf-8` everywhere.
It should have no impact, `utf8` is an alias of `utf-8` [1].

[1] ee03bad25e/Lib/encodings/aliases.py (L534)

* Always specify the encoding

Let's be explicit over implicit. And prevent future warnings from PEP-597 [1].

[1] https://www.python.org/dev/peps/pep-0597/#using-the-default-encoding-is-a-common-mistake

* Update `UTF8` constant (`utf-8` -> `utf_8`)

* Remove default argument from `str.encode()` and `bytes.decode()`

* Clean-up
2021-08-05 20:58:43 +02:00
Mickaël Schoentgen
11399dde76
Refine abstract methods and properties (#1118) 2021-08-05 20:57:23 +02:00
Mickaël Schoentgen
da47e37c44
Use builtin open() in setup.py (#1120) 2021-08-05 20:56:59 +02:00
Mickaël Schoentgen
a66af2497a
Add converter plugin streaming tests (#1117)
Also fixed minor glitches here and there and re-enabled a unicode test.
2021-08-05 14:37:08 +02:00
Miro Hrončok
a94d6d807c
Packit: Enable the Koji repsitory in Copr (#1119)
By default, only updates that are propagated trough the Fedora's update system
will be available in the community Copr build system.
On stable Fedora releases,
updates (including new packages) might be delayed 1+ week.

This adds the latest Koji (that's the name of the official Fedora build system) repo.
That repo contains more recent packages available during the official Fedora builds.

The Koji repo is not mirrored,
so the Copr builds are more likely to encounter a network issue,
but I think it is worth it.
The `/packit build` command may be used in the pull request if this happens.
2021-08-04 20:30:41 +02:00
Mickaël Schoentgen
de13423839
--download: Use time.monotonic() and rework code to prevent ZeroDivisionError specific handling (#1113) 2021-07-29 16:05:56 +02:00
Mickaël Schoentgen
04d05a8abd
Minor clean-up (#1112)
* Remove Python 2 clean-up misses

* Remove unused `Environment.devnull` setter

* Simplifies `get_filename_max_length()`
2021-07-26 23:56:38 +02:00
Mickaël Schoentgen
2f8d7f77bd
Add more download tests (#1114) 2021-07-26 20:27:36 +02:00
Anton Emelyanov
aee77a23af
Simplify spinner_pos calculation a little (#1111) 2021-07-20 18:24:49 +02:00
Mickaël Schoentgen
64c31d554a Revert "Use http in the 'hello world' example to be consitent (#1109)"
This reverts commit 41c251ec7c.
2021-07-16 15:49:41 +02:00
henryhu712
41c251ec7c
Use http in the 'hello world' example to be consitent (#1109) 2021-07-15 16:17:05 +02:00
Ilya Sukhanov
147a066dbe
Add internal support for file-like object responses to improve adapter plugin support (#1094)
* Support `requests.response.raw` being a file-like object

Previously HTTPie relied on `requests.models.Response.raw` being
`urllib3.HTTPResponse`. The `requests` documentation specifies that
(requests.models.Response.raw)[https://docs.python-requests.org/en/master/api/#requests.Response.raw]
is a file-like object but allows for other types for internal use.

This change introduces graceful handling for scenarios when
`requests.models.Response.raw` is not `urllib3.HTTPResponse`. In such a scenario
HTTPie now falls back to extracting metadata from `requests.models.Response`
directly instead of direct access from protected protected members such as
`response.raw._original_response`. A side effect in this fallback procedure is
that we can no longer determine HTTP protocol version and report it as `1.1`.

This change is necessary to make it possible to implement `TransportPlugins`
without having to also needing to emulate internal behavior of `urlib3` and
`http.client`.

* Load cookies from `response.headers` instead of `response.raw._original_response.msg._headers`

`response.cookies` was not utilized as it not possible to construct original
payload from `http.cookiejar.Cookie`. Data is stored in lossy format. For example
`Cookie.secure` defaults to `False` so we cannot distinguish if `Cookie.secure` was
set to `False` or was not set at all. Same problem applies to other fields also.

* Simpler HTTP envelope data extraction

* Test cookie extraction and make cookie presentment backwards compatible

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-07-06 21:00:06 +02:00
Mickaël Schoentgen
b7300c1096 Update Chocolatey command in the docs 2021-07-02 17:54:07 +02:00