Skip to content

Fix incorrect env var name for verify_SSL default #156

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

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

stigtsp
Copy link
Contributor

@stigtsp stigtsp commented Jun 18, 2023

The variable to override the verify_SSL default differed slightly in the documentation from what was checked for in the code.

This commit makes the code use PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT as documented, instead of PERL_HTTP_TINY_INSECURE_BY_DEFAULT which was missing SSL_

Cc: @twata1 @noxxi @rjbs

The variable to override the verify_SSL default differed slightly in the
documentation from what was checked for in the code.

This commit makes the code use `PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT`
as documented, instead of `PERL_HTTP_TINY_INSECURE_BY_DEFAULT` which was
missing `SSL_`
@stigtsp
Copy link
Contributor Author

stigtsp commented Jun 18, 2023

#155

@twata1
Copy link

twata1 commented Jun 21, 2023

Looks good to me.

C:\home\pianokey>ack PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT .\p5-http-tiny-fix-incorrect-environment-var-name
p5-http-tiny-fix-incorrect-environment-var-name\Changes
16:    - `$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}` can be used to restore the

p5-http-tiny-fix-incorrect-environment-var-name\lib\HTTP\Tiny.pm
48:* C<$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}> - Changes the default
151:    # changed by the user by setting PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1
152:    return (($ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1;
1786:behavior can be enabled by setting C<$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}>

p5-http-tiny-fix-incorrect-environment-var-name\t\180_verify_SSL.t
10:delete $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT};
56:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "1";
58:    is($ht->verify_SSL, 0, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1 changes verify_SSL default to 0");
62:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "0";
64:    is($ht->verify_SSL, 1, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=0 keeps verify_SSL default at 1");
68:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "False";
70:    is($ht->verify_SSL, 1, "Unsupported PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=False keeps verify_SSL default at 1");
74:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "1";
76:    is($ht->verify_SSL, 1, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1 does not override verify_SSL attribute set to 1");
80:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "1";
85:    is($ht->verify_SSL, 1, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1, verify_SSL=>1 and verify_ssl=>1 sets 1");
89:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "1";
94:    is($ht->verify_SSL, 1, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1, verify_SSL=>1 and verify_ssl=>0 sets 1");
98:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = "1";
103:    is($ht->verify_SSL, 0, "PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1, verify_SSL=>0 and verify_ssl=>0 sets 0");

p5-http-tiny-fix-incorrect-environment-var-name\t\210_live_ssl.t
21:delete $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT};
68:    local $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = 1;

C:\home\pianokey>ack PERL_HTTP_TINY_INSECURE_BY_DEFAULT .\p5-http-tiny-fix-incorrect-environment-var-name

C:\home\pianokey>cd p5-http-tiny-fix-incorrect-environment-var-name

C:\home\pianokey\p5-http-tiny-fix-incorrect-environment-var-name>perl Makefile.PL
Generating a dmake-style Makefile
Writing Makefile for HTTP::Tiny
Writing MYMETA.yml and MYMETA.json

C:\home\pianokey\p5-http-tiny-fix-incorrect-environment-var-name>dmake
cp lib/HTTP/Tiny.pm blib\lib\HTTP\Tiny.pm

C:\home\pianokey\p5-http-tiny-fix-incorrect-environment-var-name>dmake test
C:\"Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/
*.t
t/000_load.t ........... ok
t/001_api.t ............ ok
t/002_croakage.t ....... ok
t/003_agent.t .......... ok
t/004_timeout.t ........ ok
t/010_url.t ............ ok
t/020_headers.t ........ ok
t/030_response.t ....... ok
t/040_content.t ........ ok
t/050_chunked_body.t ... ok
t/060_http_date.t ...... ok
t/070_cookie_jar.t ..... ok
t/100_get.t ............ ok
t/101_head.t ........... ok
t/102_put.t ............ ok
t/103_delete.t ......... ok
t/104_post.t ........... ok
t/110_mirror.t ......... ok
t/130_redirect.t ....... ok
t/140_proxy.t .......... ok
t/141_no_proxy.t ....... ok
t/150_post_form.t ...... ok
t/160_cookies.t ........ ok
t/161_basic_auth.t ..... ok
t/162_proxy_auth.t ..... ok
t/170_keepalive.t ...... ok
t/180_verify_SSL.t ..... ok
t/200_live.t ........... skipped: Only run for $ENV{AUTOMATED_TESTING}
t/200_live_local_ip.t .. skipped: Only run for $ENV{AUTOMATED_TESTING}
t/210_live_ssl.t ....... skipped: Only run for $ENV{AUTOMATED_TESTING}
All tests successful.
Files=30, Tests=451, 19 wallclock secs ( 0.28 usr +  0.16 sys =  0.44 CPU)
Result: PASS

C:\home\pianokey\p5-http-tiny-fix-incorrect-environment-var-name>

@rjbs
Copy link

rjbs commented Jun 22, 2023

@xdg So, we should probably ship this or the other-way-round fix soon (a) to reduce the window of unclarity and (b) to get it in blead.

I thought about the question of which way round to go. At first, I thought: "People who write code that works with the new release will be undercut by the new one" but they will have done so by reading the code and not the docs, and have less guarantee that this should work. I think it's a bit of a mess, but that Stig's fix is the correct way.

@xdg xdg merged commit a227857 into chansen:master Jun 22, 2023
@xdg
Copy link
Collaborator

xdg commented Jun 22, 2023

Done. Will ship shortly. Thank you.

@xdg
Copy link
Collaborator

xdg commented Jun 22, 2023

HTTP-Tiny-0.086.tar.gz shipped to CPAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants