Wykres commitów

3 Commity (65a14116d503dd544cbba92284517c99e5e9a448)

Autor SHA1 Wiadomość Data
Richard Weickelt 65a14116d5 requests: Do not leak header modifications when calling request.
The requests() function takes a headers dict argument
(call-by-reference). This object is then modified in the function. For
instance the host is added and authentication information. Such behavior
is not expected. It is also problematic:

- Modifications of the header dictionary will be visible on the caller
  site.
- When reusing the same (supposedly read-only) headers object for
  differenct calls, the second call will apparently re-use wrong headers
  from the previous call and may fail.

This patch should also fix #839. Unfortunately the copy operation does
not preserve the key order and we have to touch the existing test cases.

Signed-off-by: Richard Weickelt <richard@weickelt.de>
2024-12-12 00:27:39 +01:00
Damien George 84ba452113 all: Use non-u versions of built-in modules.
This changes almost all uses of "u-module" to just "module" for the
following built-in modules:
- binascii
- collections
- errno
- io
- json
- socket
- struct
- sys
- time

There are some remaining uses of "u-module" naming, for the cases where the
built-in module is extended in Python, eg `python-stdlib/os` uses `uos`.

Also, there are remaining uses of `utime` when non-standard (compared to
CPython) functions are used, like `utime.ticks_ms()`.

Signed-off-by: Damien George <damien@micropython.org>
2024-06-14 10:35:06 +10:00
Mirza Kapetanovic 1f019f90ea requests: Make possible to override headers and allow raw data upload.
This removes all the hard-coded request headers from the requests module so
they can be overridden by user provided headers dict.  Furthermore allow
streaming request data without chunk encoding in those cases where content
length is known but it's not desirable to load the whole content into
memory.  Also some servers (e.g. nginx) reject HTTP/1.0 requests with the
Transfer-Encoding header set.

The change should be backwards compatible as long as the user hasn't
provided any of the previously hard-coded headers.

Signed-off-by: Mirza Kapetanovic <mirza.kapetanovic@gmail.com>
2024-06-14 10:25:39 +10:00