libwww-perl / libwww-perl/HTTP-Cookies

bug report [rt.cpan.org #75715]

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
4
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Migrated from rt.cpan.org#75715 (status was 'new')

Requestors:

  • jan.hulala@gmail.com

From jan.hulala@gmail.com on 2012-03-12 14:19:33:

In add_cookie_header $val should be checked as described below >>

sub add_cookie_header
{
   ...
            while (($key,$array) = each %{$cookies->{$path}}) {
                my($version,$val,$port,$path_spec,$secure,$expires) =
@$array;

                # *this line has to be added, to prevent errors for
undefined value*
                next if !defined($val);

                if ($secure && !$secure_request) {
                    next;
                }
   ...
}

----

The above recommendation is based on experience when application using
WWW::Scripter module
parsed a web page containing the following JavaScript:

           if (typeof navigator.cookieEnabled == "undefined") {
               document.cookie = "cookie";
               test = (document.cookie.indexOf("cookie") != -1) ? true :
false;
           }

Once the fix recommended above has been applied, no error occurred.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the add_cookie_header routine in the HTTP-Cookies source and inspect the loop that unpacks cookie values. Reproduce the undefined-value case described in the issue, then verify the routine handles it without an error and that the existing test suite still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.