libwww-perl / libwww-perl/HTTP-Cookies

Bug in http-cookies v6.00 [rt.cpan.org #72761]

Open
#18 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#72761 (status was 'new')

Requestors:

  • artemmus@gmail.com

From artemmus@gmail.com on 2011-11-27 19:00:39:

Hello

I found that if server set cookie with domain in format like this
".domain.com" and then
2) and then LWP goes to http://domain.com cookie not passed to http://domain.com

to fix it, I write this code in HTTP::Cookies.pm

sub add_cookie_header
{
    my $self = shift;
    my $request = shift || return;
    my $url = $request->uri;
    my $scheme = $url->scheme;
    unless ($scheme =~ /^https?\z/) {
        return;
    }

    my $domain = _host($request, $url);
    # ARTEMMUS BUG FIX, for domain with dot in front like .site.com
    $domain = '.'.$domain if $domain !~ /^\./;
    # END BUG FIX
...


-- 
С уважением,
 Artem                          mailto:artemmus@gmail.com

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

Start in HTTP::Cookies.pm at add_cookie_header and trace how cookies set for a dotted domain are matched when requesting the corresponding bare domain. Reproduce the reported request sequence and verify that the cookie is sent to http://domain.com; done means this behavior is covered and does not regress existing cookie handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.