Skip to content

net/http: http.FileServer Partial Content returns no content #27085

Closed
@klauspost

Description

@klauspost

What version of Go are you using (go version)?

Go 1.11 RC1 go version go1.11rc1 windows/amd64

Does this issue reproduce with the latest release?

No, new for 1.11

What operating system and processor architecture are you using (go env)?

c:\temp\problem>go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\mfiles\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=e:\gopath\
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=e:\temp\wintemp\go-build429745914=/tmp/go-build -gno-record-gcc-switches

What did you do?

https://download.klauspost.com/partial-content.zip

  • Unzip
  • In folder, execute go run main.go
  • Open http://localhost:8080 (reproducible in both Chrome+Firefox)
  • Press play on controller

Music will stop playing after a short while.

The browser shows that while headers are returned correctly no content is sent.

Request:

GET /music/music.mp3 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Accept: */*
Referer: http://localhost:8080/
Accept-Language: en-US,en;q=0.9,da;q=0.8
Range: bytes=65536-

Response headers:

HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-Type: audio/mpeg
Last-Modified: Sun, 22 Jul 2018 19:37:12 GMT
Date: Sun, 19 Aug 2018 16:29:30 GMT
Content-Range: bytes 65536-6909673/6909674
Content-Length: 6844138

But no content is actually sent.

What did you expect to see?

The data for the requested range to be included in the response.

What did you see instead?

0 bytes are included in the response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions