Skip to content

net/http: regression in handling bad Content-Length set by client request #8003

Closed
@gopherbot

Description

@gopherbot

by kushal.pisavadia@digital.cabinet-office.gov.uk:

Tested using `go version go1.2.1 linux/amd64` and `go version go1.1.2 linux/amd64`. Also
tested against `go version devel +f8b50ad4cac4 Mon Apr 21 17:00:27 2014 -0700 +
darwin/amd64` and the issue still exists.

What steps reproduce the problem?

1. Run `go run backend.go` in a shell
2. Run `go run server.go` in a separate shell
3. Run `ruby test_client.rb`

What happened?

In Go 1.2 the HTTP server responds with a 500 Internal Server Error

What should have happened instead?

In both cases it should respond with HTTP/1.1 400 Bad Request because the error string
will match `http: Request.ContentLength=\d+ with Body length \d+`.

Please provide any additional information below.

Full output link and code: https://gist.github.com/KushalP/46d2651acae353ee8ee6

Attachments:

  1. backend.go (225 bytes)
  2. server.go (1268 bytes)
  3. test_client.rb (757 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions