Skip to content

-irrb Sometimes returns corrupted base64 body #971

@nil0x42

Description

@nil0x42

httpx version:

1.2.6

Current Behavior:

Sometimes, binary body is altered, and decoding base64 body returns unexpected data (who looks to have been pre-encoded as utf-8)

Here is a POC:

$ echo 'https://zc-console.taobao.com/favicon.ico' | httpx -silent -json -irrb | jq .body -j | base64 -d | wc -c

2246

$ curl -s 'https://zc-console.taobao.com/favicon.ico' | wc -c

1863

Note that in this specific case, Content-Type header is set to image/x-icon;charset=GBK, so underlying http library might be automatically trying to encode data, given that charset is specified.

Expected Behavior:

-irrb should always returns a base64 version of the raw, original body's binary content, with no previous encoding

Anything else:

related to #813, #814

Metadata

Metadata

Assignees

Labels

Status: CompletedNothing further to be done with this issue. Awaiting to be closed.Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions