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

Passing an empty Host header to an HTTP 1.1 request results in a StringOutOfBoundException #2723

Closed
jamezp opened this issue Mar 10, 2023 · 1 comment · Fixed by #2724
Closed
Assignees
Labels
type/bug A general bug
Milestone

Comments

@jamezp
Copy link

jamezp commented Mar 10, 2023

Expected Behavior

The request should use a default host or at least not attempt to check the first character of an empty host. This issue seemed to be introduced here a3e6d37#diff-c53be0aa1c780a295ce5c742f574d0633894044b87e7ff68c01da79af95e5f65R68. It seems the simple solution would be to do:

if (header != null && !header.isEmpty())

Actual Behavior

You end up getting the following error:

15:52:54,501 WARNING [reactor.netty.http.server.HttpServerOperations] (reactor-http-nio-2) [7d6754c8, L:/127.0.0.1:8081 - R:/127.0.0.1:50526] Decoding failed: REQUEST(decodeResult: failure(java.lang.StringIndexOutOfBoundsException: String index out of range: 0), version: HTTP/1.1)
GET /uriinfo HTTP/1.1
Host: <filtered>
Connection: <filtered>

Steps to Reproduce

Simply pass a header like:

Host:

Possible Solution

Check if the Host header is blank/empty before attempting to substring the header value.

Your Environment

  • Reactor version(s) used: 2022.0.4
  • Other relevant libraries versions (eg. netty, ...): Netty 4.1.89.Final
  • JVM version (java -version): OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-1.fc37) (build 11.0.18+10, mixed mode, sharing)
  • OS and version (eg. uname -a): Linux localhost 6.1.14-200.fc37.x86_64 MonoHttpClientChannel subscribes to Mono with a null subscriber #1 SMP PREEMPT_DYNAMIC Sun Feb 26 00:13:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
@jamezp jamezp added status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug labels Mar 10, 2023
@violetagg violetagg self-assigned this Mar 10, 2023
@violetagg violetagg removed the status/need-triage A new issue that still need to be evaluated as a whole label Mar 10, 2023
@violetagg violetagg added this to the 1.0.30 milestone Mar 10, 2023
@violetagg
Copy link
Member

@jamezp Thanks for reporting the issue. PTAL #2724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants