sonatype-nexus-community / nexus-repository-apt

A Nexus Repository 3 plugin that allows usage of apt repositories
Eclipse Public License 1.0
105 stars 50 forks source link

The HTTP server sent an invalid Content-Range header Bad header data #47

Closed aisensiy closed 6 years ago

aisensiy commented 6 years ago

Thanks for creating an issue! Please fill out this form so we can be sure to have all the information we need, and to minimize back and forth.

Config a apt proxy for downloads.docker.com.

Add the new source list url into my ubuntu /etc/apt/source.list and success to run apt-get update but fail to download docker with command apt-get install nvidia-docker2:

The HTTP server sent an invalid Content-Range header Bad header data

I just want to use this nexus as a apt proxy where can i get more information about this? Thanks.

mpoindexter commented 6 years ago

@DarthHater - this appears to be a bug in Nexus core.

I looked into this, and it looks like PartialFetchHandler sends an invalid Content-Range header here: https://github.com/sonatype/nexus-public/blob/82d58ec7e1464cf25efca423bbe5f8cbd6eb4f55/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/http/PartialFetchHandler.java#L119

According to the RFC (https://tools.ietf.org/html/rfc7233#section-4.2) the Content-Range header needs a unit specifier of "bytes" in it.

Also, it seems like the base code doesn't correctly handle the If-Range header. I have a PR that fixes both issues if you want to merge to the base code: https://github.com/mpoindexter/nexus-public/pull/1

mpoindexter commented 6 years ago

@aisensiy - This will depend on a fix in nexus core, but in the meantime, clearing out your cached package lists in /var/lib/apt/lists and /var/lib/apt/lists/partial should probably fix the problem.

DarthHater commented 6 years ago

@mpoindexter I would file an issue in our JIRA related to this, but damn dude, good looking out!

mpoindexter commented 6 years ago

https://issues.sonatype.org/browse/NEXUS-17101

mpoindexter commented 6 years ago

Looks like this is now fixed in core 3.13