The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
--- Begin Message ---
From: "Dmitry V. Zimin" <pf...@mail.ru>

This patch add the option --post-type to pass a custom Content-Type

Signed-off-by: Dmitry V. Zimin <pf...@mail.ru>
---
 uclient-fetch.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/uclient-fetch.c b/uclient-fetch.c
index 061f0fd..ac257e2 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -44,6 +44,7 @@
 static const char *user_agent = "uclient-fetch";
 static const char *post_data;
 static const char *post_file;
+static const char *post_type;
 static struct ustream_ssl_ctx *ssl_ctx;
 static const struct ustream_ssl_ops *ssl_ops;
 static int quiet = false;
@@ -345,13 +346,13 @@ static int init_request(struct uclient *cl)
                check_resume_offset(cl);
 
        if (post_data) {
-               uclient_http_set_header(cl, "Content-Type", 
"application/x-www-form-urlencoded");
+               uclient_http_set_header(cl, "Content-Type", post_type ? 
post_type : "application/x-www-form-urlencoded");
                uclient_write(cl, post_data, strlen(post_data));
        }
        else if(post_file)
        {
                FILE *input_file;
-               uclient_http_set_header(cl, "Content-Type", 
"application/x-www-form-urlencoded");
+               uclient_http_set_header(cl, "Content-Type", post_type ? 
post_type : "application/x-www-form-urlencoded");
 
                input_file = fopen(post_file, "r");
                if (!input_file)
@@ -480,8 +481,9 @@ static int usage(const char *progname)
                "       --user=<user>                   HTTP authentication 
username\n"
                "       --password=<password>           HTTP authentication 
password\n"
                "       --user-agent|-U <str>           Set HTTP user agent\n"
-               "       --post-data=STRING              use the POST method; 
send STRING as the data\n"
-               "       --post-file=FILE                use the POST method; 
send FILE as the data\n"
+               "       --post-data=STRING              Use the POST method; 
send STRING as the data\n"
+               "       --post-file=FILE                Use the POST method; 
send FILE as the data\n"
+               "       --post-type=STRING              Set custom Content-Type 
for POST method\n"
                "       --spider|-s                     Spider mode - only 
check file existence\n"
                "       --timeout=N|-T N                Set connect/request 
timeout to N seconds\n"
                "       --proxy=on|off|-Y on|off        Enable/disable env var 
configured proxy\n"
@@ -539,6 +541,7 @@ enum {
        L_USER_AGENT,
        L_POST_DATA,
        L_POST_FILE,
+       L_POST_TYPE,
        L_SPIDER,
        L_TIMEOUT,
        L_CONTINUE,
@@ -556,6 +559,7 @@ static const struct option longopts[] = {
        [L_USER_AGENT] = { "user-agent", required_argument },
        [L_POST_DATA] = { "post-data", required_argument },
        [L_POST_FILE] = { "post-file", required_argument },
+       [L_POST_TYPE] = { "post-type", required_argument },
        [L_SPIDER] = { "spider", no_argument },
        [L_TIMEOUT] = { "timeout", required_argument },
        [L_CONTINUE] = { "continue", no_argument },
@@ -625,6 +629,9 @@ int main(int argc, char **argv)
                        case L_POST_FILE:
                                post_file = optarg;
                                break;
+                       case L_POST_TYPE:
+                               post_type = optarg;
+                               break;
                        case L_SPIDER:
                                no_output = true;
                                break;
-- 
2.28.0



--- End Message ---
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to