libwww-perl / libwww-perl/HTTP-Daemon

CONNECT with Content-Length hangs the proxy [rt.cpan.org #76988]

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

Nobody has claimed this yet.

Dominant language
Perl
Stars
6
Forks
17
PR merge metrics
No merged PRs in 30d

Description

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

Requestors:

  • vbuttazzo@yahoo.com

From vbuttazzo@yahoo.com on 2012-05-04 13:45:17
:

If a client sends a CONNECT to HTTP::Proxy that includes a Content-
Length header then the result is a hang of the proxy.

It's obviously not a normal condition, but it happened on my 
configuration using PHP with cURL and the Google Api library. This 
library explicitly sets a Content-Length header for a POST request and 
cURL sends it in the CONNECT request to the proxy. I think it's a cURL 
wrong behavior, but it was much more easier to fix on the proxy side.

The solution was simply to add this line:

    $len = $ct = $te = undef if $method eq "CONNECT";

after this code:

    my $te  = $r->header('Transfer-Encoding');
    my $ct  = $r->header('Content-Type');
    my $len = $r->header('Content-Length');

This way wrong headers are pretty ignored.

I don't know if anyone else will ever have the same problem, I think 
it's not a common situation, anyway I like to report it.

Contributor guide

Open the contributing guide

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 HTTP::Proxy request-handling code containing the Transfer-Encoding, Content-Type, and Content-Length header extraction. First reproduce a CONNECT request with Content-Length, then verify that the proxy no longer hangs and that the CONNECT request's body-related headers are ignored.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.