-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent hard-coded Content-Type for --post-data #233
Prevent hard-coded Content-Type for --post-data #233
Conversation
Upstream BusyBox wget, GNU wget and the recently released GNU wget2 all hard-code the content type for POST data. The wget documentation explicitly states:
Please take this upstream. |
Yes. I know that all of them hard coded the content-type for POST data. However they are flexible and allow to overwrite the hard-coded header by the user-defined one. I've got dove into the wget/wget2 sources. They differ significantly, but the logic is the same: they replace the default header if the end-user defined its own header. wget/cygwinBelow are examples of real usecases with wget/cygwin. wget/cygwin failed without other headers:
wget/cygwin success with a user-defined header:
wget/busybox fails in both cases. wget/linuxwget/linux acts the same way but recently I don't have any linux host opened to the Internet to show the same behavior. I can only emulate by sending requests and capturing request headers. no custom
with custom
wget/busyboxThe applet acts differently. It sends both the user-defined and hard-coded headers. There is no superseding of the default header with the user-defined one:
|
…-post-file More explanation in this PR: rmyorston/busybox-w32#233 The real use-case: wget https://api.github.com/markdown/raw --header "Content-Type: text/plain" function old new delta wget_main 2560 2581 +21 wget_user_headers 62 76 +14 .rodata 104196 104197 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 36/0) Total: 36 bytes Signed-off-by: Ildar Shaimordanov <ildar.shaimordanov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Just a humble reminder that the upstream issued the new version (unstable for now) with the suggested patch. The third commit is for the changes resolving the merge conflict and for applying the changes corresponding the upstream. |
The latest release of busybox-w32, FRP-4621-gf3c5e8bc3, pulls in the fix for this issue from upstream. |
With the
--post-data
option the headerContent-Type: application/x-www-form-urlencoded
is hard-coded and there is no way to specify a customContent-Type
header.I think the code should be modified to turn off the hard-coded header when the end user specifies its own (almost in the same way as it has been done for other headers in
wget_user_headers[]
).Update 1: I guess this PR should be submitted to upstream first. But it's a bit faster to report it to you and you forward it further.
Update 2: This PR completely is agreed with my previous PR #232.