golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.13k stars 17.69k forks source link

proposal: x/net/http2: add "SETTINGS_NO_RFC7540_PRIORITIES" #69917

Open Colduction opened 1 month ago

Colduction commented 1 month ago

Proposal Details

According to RFC 9217: Section 2, P1, the SETTINGS_NO_RFC7540_PRIORITIES is now a known setting in SETTINGS frame.

It is also used in Firefox 132.0-b8 (Dev channel), if you could add it in net/http2 for devs who have experimental usages, that would be awesome.

Like listing it's ID beside other settings here:

// A SettingID is an HTTP/2 setting as defined in
// https://httpwg.org/specs/rfc7540.html#iana-settings
type SettingID uint16

const (
    SettingHeaderTableSize      SettingID = 0x1
    SettingEnablePush           SettingID = 0x2
    SettingMaxConcurrentStreams SettingID = 0x3
    SettingInitialWindowSize    SettingID = 0x4
    SettingMaxFrameSize         SettingID = 0x5
    SettingMaxHeaderListSize    SettingID = 0x6
        SettingNoRFC7540Priorities  SettingID = 0x9
)

var settingName = map[SettingID]string{
    SettingHeaderTableSize:      "HEADER_TABLE_SIZE",
    SettingEnablePush:           "ENABLE_PUSH",
    SettingMaxConcurrentStreams: "MAX_CONCURRENT_STREAMS",
    SettingInitialWindowSize:    "INITIAL_WINDOW_SIZE",
    SettingMaxFrameSize:         "MAX_FRAME_SIZE",
    SettingMaxHeaderListSize:    "MAX_HEADER_LIST_SIZE",
        SettingNoRFC7540Priorities:  "NO_RFC7540_PRIORITIES",
}

Thanks to Go team!

ianlancetaylor commented 1 month ago

CC @neild

neild commented 1 month ago

I have no objection to adding the field to the enum. I don't think we really should be in the business of providing an enumeration of HTTP/2 settings ids, but given that we already have one there doesn't seem to be any harm in staying up to date.

Colduction commented 1 month ago

In fact I didn't mean just adding it's ID, I meant it would be great to make it easier to configure and use this setting like other SETTING frame's settings for ease of use for custom/experimental usages.

Also thanks for your replies.

neild commented 1 month ago

x/net/http2 currently doesn't support RFC 7540 stream prioritization by default.

We have http2.NewPriorityWriteScheduler, but this is known to be buggy (see https://go.dev/issue/58804), we have no evidence that it's useful (https://go.dev/issue/58804#issuecomment-1470330633), RFC 7540 prioritization is deprecated (https://www.rfc-editor.org/rfc/rfc9113.html#section-5.3), and we have a proposal to deprecate the x/net/http2 WriteScheduler interface entirely (https://go.dev/issue/67817).

So I think the only reasonable thing x/net/http2 could do with SETTINGS_NO_RFC7540_PRIORITIES is to unilaterally send it with a value of '1'.

Colduction commented 1 month ago

Yes, that would be great to send this (SETTINGS_NO_RFC7540_PRIORITIES) SETTING frame's setting with a default value of '1'.

I hope the Go community adds this feature for the next x/net/http2 update.

Thanks in advance!

neild commented 1 month ago

I have no objection to sending SETTINGS_NO_RFC7530_PRIORITIES=1 when using the default WriteScheduler. (And always, if/when we drop WriteScheduler support someday.)

gopherbot commented 4 weeks ago

Change https://go.dev/cl/621175 mentions this issue: http2: support SETTINGS_NO_RFC7540_PRIORITIES