Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/caddyfile.go (Go)

Code before:

	return nil
}

// UnmarshalCaddyfile deserializes Caddyfile tokens into h.
//
//	transport http {
//	    read_buffer             <size>
//	    write_buffer            <size>
//	    max_response_header     <size>
//		network_proxy			<module> {
//			...
//		}
//	    dial_timeout            <duration>
//	    dial_fallback_delay     <duration>
//	    response_header_timeout <duration>
//	    expect_continue_timeout <duration>
//	    resolvers               <resolvers...>
//	    tls
//	    tls_client_auth <automate_name> | <cert_file> <key_file>
//	    tls_insecure_skip_verify
//	    tls_timeout <duration>
//	    tls_trusted_ca_certs <cert_files...>
//		tls_trust_pool	<module> {
//			...
//		}
//	    tls_server_name <sni>
//	    tls_renegotiation <level>
//	    tls_except_ports <ports...>
//	    keepalive [off|<duration>]
//	    keepalive_interval <interval>
//	    keepalive_idle_conns <max_count>
//	    keepalive_idle_conns_per_host <count>
//	    versions <versions...>
//	    compression off
//	    max_conns_per_host <count>
//	    max_idle_conns_per_host <count>
//	}
func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	d.Next() // consume transport name
	for d.NextBlock(0) {
		switch d.Val() {
		case "read_buffer":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid read buffer size '%s': %v", d.Val(), err)
			}
			h.ReadBufferSize = int(size)

Review comment (suggestion):
Tabs and spaces in godoc are super funky. I think it needs to be like this:

```suggestion
//	    tls_trust_pool <module> {
//	        ...
//	    }
```

Code after:

	return nil
}

// UnmarshalCaddyfile deserializes Caddyfile tokens into h.
//
//	transport http {
//	    read_buffer             <size>
//	    write_buffer            <size>
//	    max_response_header     <size>
//	    network_proxy           <module> {
//	        ...
//	    }
//	    dial_timeout            <duration>
//	    dial_fallback_delay     <duration>
//	    response_header_timeout <duration>
//	    expect_continue_timeout <duration>
//	    resolvers               <resolvers...>
//	    tls
//	    tls_client_auth <automate_name> | <cert_file> <key_file>
//	    tls_insecure_skip_verify
//	    tls_timeout <duration>
//	    tls_trusted_ca_certs <cert_files...>
//	    tls_trust_pool <module> {
//	        ...
//	    }
//	    tls_server_name <sni>
//	    tls_renegotiation <level>
//	    tls_except_ports <ports...>
//	    keepalive [off|<duration>]
//	    keepalive_interval <interval>
//	    keepalive_idle_conns <max_count>
//	    keepalive_idle_conns_per_host <count>
//	    versions <versions...>
//	    compression off
//	    max_conns_per_host <count>
//	    max_idle_conns_per_host <count>
//	}
func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	d.Next() // consume transport name
	for d.NextBlock(0) {
		switch d.Val() {
		case "read_buffer":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid read buffer size '%s': %v", d.Val(), err)
			}
			h.ReadBufferSize = int(size)