apt downloads new repositories with “If-Modified-Since: Tue, 09 Jun 1931 07:27:48 GMT”

Bug #744832 reported by Anders Kaseorg on 2011-03-29
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)

Bug Description

Binary package hint: apt

When apt downloads package information from a new repository, it sends an If-Modified-Since header from 1931:

GET /apt/dists/natty/debathena/binary-i386/Packages.bz2 HTTP/1.1
Host: debathena.mit.edu
Connection: keep-alive
Cache-Control: max-age=0
If-Modified-Since: Sun, 07 Jun 1931 07:40:36 GMT
User-Agent: Debian APT-HTTP/1.3 (0.8.13ubuntu2)

which is so far in the past as to trigger bugs in some date parsing implementations, such as Perl’s Date::Parse::str2time:

$ perl -MDate::Parse -e 'print str2time("Sun, 07 Jun 1931 07:40:36 GMT")'
$ perl -MPOSIX -e 'print strftime("%a, %d %b %Y %T %z", gmtime(1938584436))'
Sat, 07 Jun 2031 07:40:36 -0400

If apt does not have a copy of the file yet, it should send no If-Modified-Since header at all, instead of one that’s far in the past.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: apt 0.8.13ubuntu2
ProcVersionSignature: Ubuntu 2.6.38-7.39-generic 2.6.38
Uname: Linux 2.6.38-7-generic x86_64
NonfreeKernelModules: openafs
Architecture: amd64
Date: Tue Mar 29 04:12:36 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20101202)
 PATH=(custom, user)
SourcePackage: apt
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Anders Kaseorg (andersk) wrote :
Torsten Spindler (tspindler) wrote :

I looked at method/http.cc and there is a check for last modified to be 0 or not:

      if (Itm->LastModified != 0)
  sprintf(Buf,"If-Modified-Since: %s\r\n",TimeRFC1123(Itm->LastModified).c_str());
  Req += Buf;

I guess that the LastModified field is not correctly initialized, as this changelog entry states it has been fixed:

apt (0.7.7) unstable; urgency=low
  * methods/https.cc:
    - only send LastModified if we actually have a file

Michael Vogt (mvo) on 2011-04-04
Changed in apt (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt -

apt ( natty; urgency=low

  * merged fixes from the debian-sid (LP: #744832)

apt ( unstable; urgency=low

  * apt-pkg/acquire-item.cc: Use stat buffer if stat was
    successful, not if it failed (Closes: #620546)
 -- Michael Vogt <email address hidden> Mon, 04 Apr 2011 14:40:51 +0200

Changed in apt (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers