Commit Graph

13 Commits

Author SHA1 Message Date
Colin Percival
e81875ba53 Improve conformance to the HTTP specification by using case-insensitive
comparisons for header keywords.  Apparently some proxies use creative
capitalization.

Weird proxy found by:	brooks
MFC after:		3 days
2008-02-13 20:46:23 +00:00
Colin Percival
220a80611e Add support for HTTP/1.0 Persistent Connections to phttpget. Requests are
be marked as HTTP/1.1 but "Connection: Keep-Alive" is added; this convinces
HTTP/1.0 servers and proxies to hold the TCP connection open despite not
being able to use HTTP pipelining.

This dramatically cuts down on the number of TCP connections (and thus port
numbers) used by portsnap when talking to an HTTP/1.0 proxy (e.g., squid),
and has the side benefit of improving performance in those cases.

Tested by:	simon
Approved by:	re (kensmith)
MFC After:	1 week
2007-06-30 19:48:28 +00:00
Colin Percival
ab5b7534b6 Add support for the HTTP_TIMEOUT environment variable (integer number
of seconds, just like in fetch(1)).

Submitted by:	rdivacky
2006-11-07 09:18:09 +00:00
Colin Percival
b39855baee Allow the HTTP_PROXY environment variable to be (mis)spelled as
"http_proxy", since some people apparently do this and fetch(3)
allows it.
2006-05-05 04:47:00 +00:00
Hajimu UMEMOTO
905b98c5f4 Correct handling of HTTP_PROXY_AUTH. A password may have `:'.
Approved by:	cperciva
MFC after:	2 days
2006-03-07 19:04:16 +00:00
Colin Percival
b258da0fa9 Merge from accidental commit to RELENG_5:
Correctly identify the host and port values on a failed
  getaddrinfo lookup.
2006-01-27 14:42:15 +00:00
Colin Percival
5c67112b9e Correctly handle a TCP connection being shutdown by the server while
we're reading response headers.  (Handle it as a connection-killing
error, rather than entering an infinite loop reading zero bytes.)

Reported by:	simon
Discovered thanks to:	A not-very-transparent transparent HTTP proxy.
MFC after:	3 days
2005-11-17 11:01:32 +00:00
Colin Percival
31c06b3f09 Add HTTP proxy authentication, via the HTTP_PROXY_AUTH environment
variable.

Tested by:	Emil Mikulic
X-MFC-After:	6.0-RELEASE
2005-09-22 07:11:27 +00:00
Colin Percival
3e4858ff09 Style fix: "if (pointer)" -> "if (pointer != NULL)" 2005-09-21 18:42:56 +00:00
Colin Percival
9de71e6fdd Remove unused variable.
Reported by:	stefanf
2005-08-10 13:45:00 +00:00
Colin Percival
3ad7e67045 Replace INT_MAX with OFF_MAX. I used INT_MAX originally (in ports)
because OFF_MAX wasn't defined on FreeBSD 4.x.
2005-08-09 08:33:27 +00:00
Colin Percival
f79293da85 When parsing the HTTP_PROXY environment variable, strip a trailing /
from the port number (if any exists).  This unbreaks
env HTTP_PROXY="http://localhost:3128/" portsnap fetch

While I'm here, list both the host and the port in the error message
output if getaddrinfo() fails, since either of them could be responsible
for the failure.
2005-08-09 03:32:29 +00:00
Colin Percival
6fb01948ee Add portsnap to the base system. This is a secure, easy to use,
fast, lightweight, and generally good way for users to keep their
ports trees up to date.

This is version 0.9.4 from the ports tree (sysutils/portsnap) with
the following changes:
1. The experimental pipelined http code is enabled.  No seatbelts
in -CURRENT. (^_^)
2. The working directory has moved from /usr/local/portsnap to
/var/db/portsnap (as discussed on -arch two days ago).
3. Portsnap now fetches a list of mirrors (distributed as DNS SRV
records) and selects one randomly.  This should help to avoid the
uneven loading which plagues the cvsup mirror network.
4. The license is now 2-clause BSD instead of 3-clause BSD.
5. Various incidental changes to make portsnap fit into the base
system's build mechanics.

X-MFC-After:    6.0-RELEASE
X-MFC-Before:   5.5-RELEASE
X-MFC-To:       RELENG_6, RELENG_5, ports
discussed on:   -arch and several other places
"yes please" from:      simon, remko, flz, Diane Bruce
thinks this is a great idea:    bsdimp
Hopes he didn't forget any files:       cperciva
2005-08-08 20:10:06 +00:00