Thu Oct 20 21:21:25 2016 UTC ()
Only set the cached flag when the connection is actually cached. New
connections should not have it set. This changes the behavior of
timeouts on the first read.


(joerg)
diff -r1.38 -r1.39 pkgsrc/net/libfetch/files/http.c

cvs diff -r1.38 -r1.39 pkgsrc/net/libfetch/files/http.c (expand / switch to unified diff)

--- pkgsrc/net/libfetch/files/http.c 2016/02/08 13:27:42 1.38
+++ pkgsrc/net/libfetch/files/http.c 2016/10/20 21:21:25 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: http.c,v 1.38 2016/02/08 13:27:42 jperkin Exp $ */ 1/* $NetBSD: http.c,v 1.39 2016/10/20 21:21:25 joerg Exp $ */
2/*- 2/*-
3 * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav 3 * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
4 * Copyright (c) 2003 Thomas Klausner <wiz@NetBSD.org> 4 * Copyright (c) 2003 Thomas Klausner <wiz@NetBSD.org>
5 * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org> 5 * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer 12 * notice, this list of conditions and the following disclaimer
13 * in this position and unchanged. 13 * in this position and unchanged.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -709,27 +709,27 @@ http_authorize(conn_t *conn, const char  @@ -709,27 +709,27 @@ http_authorize(conn_t *conn, const char
709 709
710/* 710/*
711 * Connect to the correct HTTP server or proxy. 711 * Connect to the correct HTTP server or proxy.
712 */ 712 */
713static conn_t * 713static conn_t *
714http_connect(struct url *URL, struct url *purl, const char *flags, int *cached) 714http_connect(struct url *URL, struct url *purl, const char *flags, int *cached)
715{ 715{
716 conn_t *conn; 716 conn_t *conn;
717 int af, verbose; 717 int af, verbose;
718#if defined(TCP_NOPUSH) && !defined(__APPLE__) 718#if defined(TCP_NOPUSH) && !defined(__APPLE__)
719 int val; 719 int val;
720#endif 720#endif
721 721
722 *cached = 1; 722 *cached = 0;
723 723
724#ifdef INET6 724#ifdef INET6
725 af = AF_UNSPEC; 725 af = AF_UNSPEC;
726#else 726#else
727 af = AF_INET; 727 af = AF_INET;
728#endif 728#endif
729 729
730 verbose = CHECK_FLAG('v'); 730 verbose = CHECK_FLAG('v');
731 if (CHECK_FLAG('4')) 731 if (CHECK_FLAG('4'))
732 af = AF_INET; 732 af = AF_INET;
733#ifdef INET6 733#ifdef INET6
734 else if (CHECK_FLAG('6')) 734 else if (CHECK_FLAG('6'))
735 af = AF_INET6; 735 af = AF_INET6;