Use getprotobyname() to retrieve protocol number for TCP

(sorry, I don't know how to add this to the configure process).
This commit is contained in:
Gisle Vanem
2006-02-26 17:08:33 +00:00
parent f592ea6c30
commit 60b029869f
3 changed files with 13 additions and 1 deletions

View File

@@ -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()));