Net::HTTP does not allow buffer size to be overridden in subclass [rt.cpan.org #25069]
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- perl
- Domain
- networking
Research direction
Start by tracing read_response_headers() through my_readline() and the sysread() call described in the issue, including the hard-coded 1024-byte size. The work is done when the buffer size can be configured or the read helper can be overridden cleanly by a subclass without duplicating read_response_headers().
Written by the indexing model from the issue text.
Description
Migrated from rt.cpan.org#25069 (status was 'open')
Requestors:
From [email protected] on 2007-02-21 22:00:19:
In Net::HTTP, read_response_headers() uses the function my_readline() to do it's dirty-work.
Under the hood, my_readline() calls sysread() with a HARD-CODED size of 1024. Ideally, this
should be an option, or otherwise parameterized. Alternately, it would make sense to
replace my_readline() in a subclass, but this is impossible since it is called as a function. One
would need to replace read_response_headers() entirely in a subclass if one wanted to
change the behavior here (to capture a larger buffer in the first read, cutting down on
latency.) Alternately, one could redefine the my_readline() function. The last two options are
terrible designs, since they involve cloning the existing code and replacing only a small bit,
and may result in future incompatibilities.
my $n = $self->sysread($_, 1024, length);
I suggest you expose or otherwise parameterize this currently hard-coded value.
Here is my current (nasty) workaround in a subclass:
package MyNetHTTP;
use base 'Net::HTTP';
sub my_sysread {
my $self = shift;
$_[1] = $READ_BUFFER_LENGTH;
$self->SUPER::sysread(@_);
}
sub read_response_headers {
my $self = shift;
local *sysread = *my_sysread;
$self->SUPER::read_response_headers( @_ );
}
From [email protected] on 2017-01-25 21:40:44:
migrated queues: libwww-perl -> Net-HTTP
- Dominant language
- Perl
- Stars
- 20
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libwww-perl/Net-HTTP
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
libwww-perl/Net-HTTP#99 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
libwww-perl/Net-HTTP#95 ·
-
t/live.t may failOpen
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
libwww-perl/Net-HTTP#87 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
libwww-perl/Net-HTTP#79 · 6 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 48/100
libwww-perl/Net-HTTP#74 ·
All issues in libwww-perl/Net-HTTP
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Perl/perl5#24942 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
PDLPorters/pdl#561 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/eolang.sty#197 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
radiator-software/p5-net-ssleay#577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
beyondgrep/website#143 ·