FeistyLemur has asked for the wisdom of the Perl Monks concerning the following question:
>Greetings, I am attempting to reconstruct a post (using WWW::Mechanize and LWP::UserAgent so far) in order to upload a file and navigating some things I'm unfamiliar with. All my reading into examples has led me to the following code. I've truncated to the relevant section. I am having no issues with my first request to Authenticate and populate my $auth_key value with a previous request.
#!/usr/bin/perl -w use strict; use IO::Socket::SSL qw(); use LWP::UserAgent; my $url_fw_upload='https://xxx.xxx.xxx.xxx/local/fwLoad?X-Progress-ID= +xxxxxxxxxxxxx'; my $ua=LWP::UserAgent->new(ssl_opts => { SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE, verify_hostname => 0, }); $response=$ua->post($url_fw_upload, Authorization=>"Bearer $auth_key", Content_Type=>'form-data', Content => [ "file" =>['firmware.img' => '/home/user/firmware.img'], ], );
So the thing which is new to me is "fwLoad?X-Progress-ID", which is a Javascript generated UUID for file upload progress. I've used the same UUID that I grabbed from a browser debug session, within that browser debug I also have after the Request headers and before the Request Payload "Query String Parameters" with "X-Progress-ID: xxxxxxxxxxxxx". Since I have no Javascript capability here I'm trying to get around this and not sure if I even can without full Javascript functionality.
The results are always the same, 400 bad request. Any suggestions to point me in the right direction would be welcome as I've come up blank in my searches so far.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Seeking help with HTTPS form upload.
by hippo (Archbishop) on Oct 13, 2021 at 09:06 UTC | |
by FeistyLemur (Acolyte) on Oct 13, 2021 at 16:05 UTC | |
by hippo (Archbishop) on Oct 13, 2021 at 23:05 UTC | |
by FeistyLemur (Acolyte) on Oct 14, 2021 at 18:42 UTC | |
|
Re: Seeking help with HTTPS form upload.
by Corion (Patriarch) on Oct 13, 2021 at 07:26 UTC | |
|
Re: Seeking help with HTTPS form upload.
by NERDVANA (Priest) on Oct 13, 2021 at 02:29 UTC | |
by FeistyLemur (Acolyte) on Oct 13, 2021 at 16:42 UTC | |
by Bod (Parson) on Oct 13, 2021 at 21:07 UTC |