Skip to content

Commit ee16d07

Browse files
authored
docs: add WithDisableHeaderNamesNormalizing option (#791)
1 parent 734b2bc commit ee16d07

File tree

4 files changed

+99
-95
lines changed

4 files changed

+99
-95
lines changed

content/en/docs/hertz/reference/config.md

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,46 @@ func main() {
2222
}
2323
```
2424

25-
| Configuration Name | Type | Description |
26-
| :---- | :---- | :---- |
27-
| WithTransport | network.NewTransporter | Replace the transport. Default:netpoll.NewTransporter |
28-
| WithHostPorts | string | Specify the listening address and port |
29-
| WithKeepAliveTimeout | time.Duration | Set the keep-alive time of tcp persistent connection, generally no need to modify it, you should more pay attention to idleTimeout rather than modifying it. Default: 1min. |
30-
| WithReadTimeout | time.Duration | The timeout of data reading. Default:3min. |
31-
| WithIdleTimeout | time.Duration | The free timeout of the request link for persistent connection. Default: 3min. |
32-
| WithMaxRequestBodySize | int | Max body size of a request. Default: 4M (the corresponding value of 4M is 4\*1024\*1024). |
33-
| WithRedirectTrailingSlash | bool | Whether to redirect with the / which is at the end of the router automatically. For example: If there is only /foo/ in the router, /foo will be redirected to /foo/. And if there is only /foo in the router, /foo/ will be redirected to /foo. Default: true. |
34-
| WithRemoveExtraSlash | bool | RemoveExtraSlash makes the parameter still valid when it contains an extra /. For example, if WithRemoveExtraSlash is true user//xiaoming can match the user/:name router. Default: false. |
35-
| WithUnescapePathValues | bool | If true, the request path will be escaped automatically (eg. '%2F' -> '/'). If UseRawPath is false (the default), UnescapePathValues is true, because URI().Path() will be used and it is already escaped. To set WithUnescapePathValues to false, you need to set WithUseRawPath to true. Default (true). |
36-
| WithUseRawPath | bool | If true, the original path will be used to match the route. Default: false. |
37-
| WithHandleMethodNotAllowed | bool | If true when the current path cannot match any method, the server will check whether other methods are registered with the route of the current path, and if exist other methods, it will respond "Method Not Allowed" and return the status code 405; if not, it will use the handler of NotFound to handle it. Default: false. |
38-
| WithDisablePreParseMultipartForm | bool | If true, the multipart form will not be preprocessed. The body can be obtained via ctx.Request.Body() and then can be processed by user. Default: false. |
39-
| WithStreamBody | bool | If true, the body will be handled by stream processing. Default: false. |
40-
| WithNetwork | string | Set the network protocol, optional: tcp,udp,unix(unix domain socket). Default: tcp. |
41-
| ContinueHandler | func(header *RequestHeader) bool | Call the ContinueHandler after receiving the Expect 100 Continue header. With ContinueHandler, the server can decide whether to read the potentially large request body based on the header. |
42-
| PanicHandler | HandlerFunc | Handle panic used to generate error pages and return error code 500. |
43-
| NotFound | HandlerFunc | The handler to be called when the route does not match. |
44-
| WithExitWaitTime | time.Duration | Set the graceful exit time. the Server will stop connection establishment for new requests and set the Connection: Close header for each request after closing. When the set time is reached, Server will to be closed. the Server can be closed early when all connections have been closed. Default: 5s. |
45-
| WithTLS | tls.Config | Configuring server tls capabilities. |
46-
| WithListenConfig | net.ListenConfig | Set the listener configuration. Can be used to set whether to allow reuse ports, etc.|
47-
| WithALPN | bool | Whether to enable ALPN. Default: false. |
48-
| WithTracer | tracer.Tracer | Inject tracer implementation, if not inject Tracer. Default: close. |
49-
| WithTraceLevel | stats.Level | Set trace level, Default: LevelDetailed. |
50-
| WithWriteTimeout | time.Duration | The timeout of data writing. Default:infinite.|
51-
| WithRedirectFixedPath | bool | If enabled, if the current request path does not match, the server will try to repair the request path and re-match, if the match is successful and the request is a GET request, it will return status code 301 for redirect, other requests will return 308 for redirect. Disabled by default |
52-
| WithBasePath | string | Set the base path, which must be prefixed and suffixed with `/`. The default is `/` |
53-
| WithMaxKeepBodySize | int | Sets the maximum size of the request body and response body to be retained during reclaim. Unit: Byte. Default value: 4 * 1024 * 1024 |
54-
| WithGetOnly | bool | If enabled, only GET requests are accepted. Disabled by default |
55-
| WithKeepAlive | bool | If enabled, use HTTP keepalive. Enabled by default |
56-
| WithAltTransport | network.NewTransporter | Set up the alternate transport. Default value: netpoll.NewTransporter |
57-
| WithH2C | bool | Sets whether H2C is enabled. Disabled by default |
58-
| WithReadBufferSize | int | Set the read buffer size while limiting the HTTP header size. Default value: 4 * 1024 |
59-
| WithRegistry | registry.Registry, *registry.Info | Setup registry configuration, service registration information. Default value: registry.NoopRegistry, nil |
60-
| WithAutoReloadRender | bool, time.Duration | Set up the automatic reload rendering configuration. Default value: false, 0 |
61-
| WithDisablePrintRoute | bool | Sets whether debugPrintRoute is disabled. Default disable |
62-
| WithOnAccept | func(conn net.Conn) context.Context | Set the callback function when a new connection is accepted but cannot receive data in netpoll. In go net, it will be called before converting tls connection. Default value: nil |
25+
| Configuration Name | Type | Description |
26+
| :---- |:-------------------------------------------------------------| :---- |
27+
| WithTransport | network.NewTransporter | Replace the transport. Default:netpoll.NewTransporter |
28+
| WithHostPorts | string | Specify the listening address and port |
29+
| WithKeepAliveTimeout | time.Duration | Set the keep-alive time of tcp persistent connection, generally no need to modify it, you should more pay attention to idleTimeout rather than modifying it. Default: 1min. |
30+
| WithReadTimeout | time.Duration | The timeout of data reading. Default:3min. |
31+
| WithIdleTimeout | time.Duration | The free timeout of the request link for persistent connection. Default: 3min. |
32+
| WithMaxRequestBodySize | int | Max body size of a request. Default: 4M (the corresponding value of 4M is 4\*1024\*1024). |
33+
| WithRedirectTrailingSlash | bool | Whether to redirect with the / which is at the end of the router automatically. For example: If there is only /foo/ in the router, /foo will be redirected to /foo/. And if there is only /foo in the router, /foo/ will be redirected to /foo. Default: true. |
34+
| WithRemoveExtraSlash | bool | RemoveExtraSlash makes the parameter still valid when it contains an extra /. For example, if WithRemoveExtraSlash is true user//xiaoming can match the user/:name router. Default: false. |
35+
| WithUnescapePathValues | bool | If true, the request path will be escaped automatically (eg. '%2F' -> '/'). If UseRawPath is false (the default), UnescapePathValues is true, because URI().Path() will be used and it is already escaped. To set WithUnescapePathValues to false, you need to set WithUseRawPath to true. Default (true). |
36+
| WithUseRawPath | bool | If true, the original path will be used to match the route. Default: false. |
37+
| WithHandleMethodNotAllowed | bool | If true when the current path cannot match any method, the server will check whether other methods are registered with the route of the current path, and if exist other methods, it will respond "Method Not Allowed" and return the status code 405; if not, it will use the handler of NotFound to handle it. Default: false. |
38+
| WithDisablePreParseMultipartForm | bool | If true, the multipart form will not be preprocessed. The body can be obtained via ctx.Request.Body() and then can be processed by user. Default: false. |
39+
| WithStreamBody | bool | If true, the body will be handled by stream processing. Default: false. |
40+
| WithNetwork | string | Set the network protocol, optional: tcp,udp,unix(unix domain socket). Default: tcp. |
41+
| ContinueHandler | func(header *RequestHeader) bool | Call the ContinueHandler after receiving the Expect 100 Continue header. With ContinueHandler, the server can decide whether to read the potentially large request body based on the header. |
42+
| PanicHandler | HandlerFunc | Handle panic used to generate error pages and return error code 500. |
43+
| NotFound | HandlerFunc | The handler to be called when the route does not match. |
44+
| WithExitWaitTime | time.Duration | Set the graceful exit time. the Server will stop connection establishment for new requests and set the Connection: Close header for each request after closing. When the set time is reached, Server will to be closed. the Server can be closed early when all connections have been closed. Default: 5s. |
45+
| WithTLS | tls.Config | Configuring server tls capabilities. |
46+
| WithListenConfig | net.ListenConfig | Set the listener configuration. Can be used to set whether to allow reuse ports, etc.|
47+
| WithALPN | bool | Whether to enable ALPN. Default: false. |
48+
| WithTracer | tracer.Tracer | Inject tracer implementation, if not inject Tracer. Default: close. |
49+
| WithTraceLevel | stats.Level | Set trace level, Default: LevelDetailed. |
50+
| WithWriteTimeout | time.Duration | The timeout of data writing. Default:infinite.|
51+
| WithRedirectFixedPath | bool | If enabled, if the current request path does not match, the server will try to repair the request path and re-match, if the match is successful and the request is a GET request, it will return status code 301 for redirect, other requests will return 308 for redirect. Disabled by default |
52+
| WithBasePath | string | Set the base path, which must be prefixed and suffixed with `/`. The default is `/` |
53+
| WithMaxKeepBodySize | int | Sets the maximum size of the request body and response body to be retained during reclaim. Unit: Byte. Default value: 4 * 1024 * 1024 |
54+
| WithGetOnly | bool | If enabled, only GET requests are accepted. Disabled by default |
55+
| WithKeepAlive | bool | If enabled, use HTTP keepalive. Enabled by default |
56+
| WithAltTransport | network.NewTransporter | Set up the alternate transport. Default value: netpoll.NewTransporter |
57+
| WithH2C | bool | Sets whether H2C is enabled. Disabled by default |
58+
| WithReadBufferSize | int | Set the read buffer size while limiting the HTTP header size. Default value: 4 * 1024 |
59+
| WithRegistry | registry.Registry, *registry.Info | Setup registry configuration, service registration information. Default value: registry.NoopRegistry, nil |
60+
| WithAutoReloadRender | bool, time.Duration | Set up the automatic reload rendering configuration. Default value: false, 0 |
61+
| WithDisablePrintRoute | bool | Sets whether debugPrintRoute is disabled. Default disable |
62+
| WithOnAccept | func(conn net.Conn) context.Context | Set the callback function when a new connection is accepted but cannot receive data in netpoll. In go net, it will be called before converting tls connection. Default value: nil |
6363
| WithOnConnect | func(ctx context.Context, conn network.Conn) context.Context | Set the onConnect function. It can received data from connection in netpoll. In go net, it will be called after converting tls connection. Default value: nil |
64+
| WithDisableHeaderNamesNormalizing| bool |Sets whether or not to disable Request and Response Header name normalization (capitalization of the first letter and the first letter after a dash)|
6465

6566
Server Connection limitation:
6667

content/en/docs/hertz/tutorials/basic-feature/engine.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type Hertz struct {
5656
| WithDisablePrintRoute | false | Sets whether debugPrintRoute is disabled |
5757
| WithOnAccept | nil | Set the callback function when a new connection is accepted but cannot receive data in netpoll. In go net, it will be called before converting tls connection |
5858
| WithOnConnect | nil | Set the onConnect function. It can received data from connection in netpoll. In go net, it will be called after converting tls connection |
59+
| WithDisableHeaderNamesNormalizing|false|Sets whether or not to disable Request and Response Header name normalization (capitalization of the first letter and the first letter after a dash)|
5960

6061
Server Connection limitation:
6162

0 commit comments

Comments
 (0)