Fix #34 (make libfetch always add "Accept: */*" in the HTTP header).

This commit is contained in:
Juan RP 2014-03-18 14:08:40 +01:00
parent d01d2edf5b
commit d0a9bbb912
2 changed files with 14 additions and 0 deletions

6
NEWS
View File

@ -1,5 +1,11 @@
xbps-0.34 (???):
* Fix #34 (xbps-uhelper fetch fails to download files from https://alioth.debian.org).
The issue is that this HTTP server returns 406 (Not Acceptable) when the HTTP
header does not contain the "Accept" field (see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712261 for more info).
Our libfetch code now always adds "Accept: */*" in the HTTP headers.
* Added some debugging in error paths when performing a transaction.
* Fixed an issue where in a transaction a package with wrong version was being

View File

@ -939,8 +939,16 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
http_cmd(conn, "User-Agent: %s\r\n", p);
else
http_cmd(conn, "User-Agent: %s\r\n", _LIBFETCH_VER);
/*
* Some servers returns 406 (Not Acceptable) if the Accept field is not
* provided by the user agent, such example is http://alioth.debian.org.
*/
http_cmd(conn, "Accept: */*\r\n");
if (url->offset > 0)
http_cmd(conn, "Range: bytes=%lld-\r\n", (long long)url->offset);
http_cmd(conn, "\r\n");
/*