Skip to content

do_httpx3: Use of uninitialized value $headers in split ... #490

@EnDe

Description

@EnDe

This perl warning happens when the server returns an empty response.
I'd suggest following patch:

index 3838b59..a25944b 100644
--- a/SSLeay.pm
+++ b/SSLeay.pm-1.94-do_httpx3-patch
@@ -1800,6 +1800,7 @@ sub do_httpx3 {
     return (undef, "HTTP/1.0 900 NET OR SSL ERROR$CRLF$CRLF$errs") if $errs;
 
     $http = '' if !defined $http;
+    $http = "\n" if '' eq $http; # to avoid "Use of uninitialized value $headers in split ..." below if httpx_cat() returned empty content
     ($headers, $page) = split /\s?\n\s?\n/, $http, 2;
     warn "headers >$headers< page >>$page<< http >>>$http<<<" if $trace>1;
     ($response, $headers) = split /\s?\n/, $headers, 2;

To be improved in many ways, as this change may have side effects when headers are used elsewhere; I didn't search at other places in the code ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions