Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pulsar-Proxy] Fix request.getContentLength() to return 0 if it is less than 0 #8448

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

magrain
Copy link
Contributor

@magrain magrain commented Nov 4, 2020

Motivation

  • "Negative initial size: -1" error occurs when submitting an HTTP request which has "Content-Type: application/json" and no request body .

Modifications

  • Pass 0 to argument of ByteArrayOutputStream if request.getContentLength() returns a negative number.
  • Add unit test.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • AdminProxyHandlerTest.java

example:

  • If request.getContentLength () returns -1, make sure bodyBuffer is 0.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@nkurihar nkurihar added area/proxy type/bug The PR fixed a bug or issue reported a bug labels Nov 5, 2020
@nkurihar
Copy link
Contributor

nkurihar commented Nov 5, 2020

/pulsarbot run-failure-checks

@sijie sijie added this to the 2.7.0 milestone Nov 5, 2020
@sijie sijie merged commit 9ff9284 into apache:master Nov 5, 2020
@codelipenghui
Copy link
Contributor

cherry-picked to branch-2.6

codelipenghui pushed a commit that referenced this pull request Nov 10, 2020
### Motivation

- "Negative initial size: -1" error occurs when submitting an HTTP request which has "Content-Type: application/json"  and no request body .

### Modifications

- Pass 0 to argument of ByteArrayOutputStream if request.getContentLength() returns a negative number.
- Add unit test.


(cherry picked from commit 9ff9284)
codelipenghui pushed a commit to streamnative/pulsar-archived that referenced this pull request Nov 13, 2020
…he#8448)

### Motivation

- "Negative initial size: -1" error occurs when submitting an HTTP request which has "Content-Type: application/json"  and no request body .

### Modifications

- Pass 0 to argument of ByteArrayOutputStream if request.getContentLength() returns a negative number.
- Add unit test.


(cherry picked from commit 9ff9284)
(cherry picked from commit b2f0837)
flowchartsman pushed a commit to flowchartsman/pulsar that referenced this pull request Nov 17, 2020
…he#8448)

### Motivation

- "Negative initial size: -1" error occurs when submitting an HTTP request which has "Content-Type: application/json"  and no request body .

### Modifications

- Pass 0 to argument of ByteArrayOutputStream if request.getContentLength() returns a negative number.
- Add unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/proxy release/2.6.3 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants