diff options
author | Gisle Vanem <gvanem@broadpark.no> | 2006-02-26 17:08:33 +0000 |
---|---|---|
committer | Gisle Vanem <gvanem@broadpark.no> | 2006-02-26 17:08:33 +0000 |
commit | 60b029869f3f21ba73350793f8f7355f13d538cc (patch) | |
tree | a405e9a436ab886e4f6df73e5aeee5dc5afffb81 /lib/connect.c | |
parent | f592ea6c30c375b2db0f1fbd77bcd20a07719d03 (diff) | |
download | curl-60b029869f3f21ba73350793f8f7355f13d538cc.tar.gz |
Use getprotobyname() to retrieve protocol number for TCP
(sorry, I don't know how to add this to the configure process).
Diffstat (limited to 'lib/connect.c')
-rw-r--r-- | lib/connect.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c index 787951136..427a87431 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -619,7 +619,15 @@ static void tcpnodelay(struct connectdata *conn, #ifdef TCP_NODELAY struct SessionHandle *data= conn->data; socklen_t onoff = (socklen_t) data->set.tcp_nodelay; - if(setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&onoff, + int proto = IPPROTO_TCP; + +#ifdef HAVE_GETPROTOBYNAME + struct protoent *pe = getprotobyname("tcp"); + if (pe) + proto = p->p_proto; +#endif + + if(setsockopt(sockfd, proto, TCP_NODELAY, (void *)&onoff, sizeof(onoff)) < 0) infof(data, "Could not set TCP_NODELAY: %s\n", Curl_strerror(conn, Curl_ourerrno())); |