Skip to content

add tcp_nodelay #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/HTTP/Tiny.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ use warnings;

use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
use Socket qw[SOL_SOCKET SO_KEEPALIVE];
use Socket qw[SOL_SOCKET SO_KEEPALIVE TCP_NODELAY IPPROTO_TCP];

# PERL_HTTP_TINY_IPV4_ONLY is a private environment variable to force old
# behavior if someone is unable to boostrap CPAN from a new perl install; it is
Expand Down Expand Up @@ -1117,6 +1117,8 @@ sub connect {
Timeout => $self->{timeout},
) or die(qq/Could not connect to '$host:$port': $@\n/);

$self->{fh}->setsockopt(IPPROTO_TCP, TCP_NODELAY, 1);

binmode($self->{fh})
or die(qq/Could not binmode() socket: '$!'\n/);

Expand Down