Skip to content

Conversation

@maskit
Copy link
Member

@maskit maskit commented Sep 7, 2023

One of autest failed on #10304 , and it discovered that there is a place mishandling Host header value.

The original code used the entire Host header value as a hostname, and it confused url_print() because "hostname" contains a colon. url_print() treated the hostname as IPv6 address and it added brackets to the hostname like [foo.example:8888]. If it's used in an URL (i.e. http://[foo.example:8888]/), it means/will be read as an (invalid) IPv6 address foo.exmample:8080 and port 80.

This PR fix the issue. The behavior is described in the comments.

@maskit maskit added the HTTP label Sep 7, 2023
@maskit maskit added this to the 10.0.0 milestone Sep 7, 2023
@maskit maskit self-assigned this Sep 7, 2023
@maskit
Copy link
Member Author

maskit commented Sep 7, 2023

@treak Basically what we discussed today. I added IPv6 support.

Copy link
Contributor

@traeak traeak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should take care of the ipv6 host/port setting issue.

@maskit maskit merged commit 9433581 into apache:master Sep 11, 2023
@zwoop
Copy link
Contributor

zwoop commented Sep 13, 2023

Cherry-picked to v9.2.x

@zwoop zwoop modified the milestones: 10.0.0, 9.2.3 Sep 13, 2023
zwoop pushed a commit that referenced this pull request Sep 13, 2023
* Don't set port number as part of hostname

* Initialize host_len with 0

(cherry picked from commit 9433581)
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Sep 26, 2023
* Don't set port number as part of hostname

* Initialize host_len with 0

(cherry picked from commit 9433581)
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jun 3, 2024
* asf/master:
  Don't set port number as part of hostname (apache#10386)
  JSONRPC handler: Add check for the lifecycle hooks. (apache#10312)
  Removes all HostDB persistent storage (apache#10368)
  Restores the traffic_server option for --maxRecords (apache#10388)
  URL.cc: url_length_get consider ipv6 address with added [] (apache#10387)
  make alternate tests wait a multiple of cache_config_mutex_retry_delay (apache#10378)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants