Skip to content

Commit f7df5cf

Browse files
committed
Add some Background information about max_form_buffer
Due to the nature of this module to handle files from client have I added some Background information about the parmater max_form_buffer
1 parent 0f47a3d commit f7df5cf

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

README.adoc

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# caddyv2-upload
1+
= caddyv2-upload
2+
:toc:
23

34
This repo holds a simple caddyserver v2 upload handler
45

@@ -12,9 +13,9 @@ In this handler are the following modules in use.
1213
* github.com/caddyserver/jsonc-adapter
1314
* upload :-)
1415
15-
## Configuration
16+
== Configuration
1617

17-
### Parameters
18+
=== Parameters
1819

1920
[cols="2,6",options=header]
2021
|===
@@ -50,10 +51,10 @@ In this handler are the following modules in use.
5051
|This is the Parameter where you can define the CA for the **notify_url**.
5152
|===
5253

53-
### JSON
54+
=== JSON
5455

5556
Because I prefer the https://caddyserver.com/docs/json/[JSON Config ]
56-
will I write here the config in JSON Syntax.
57+
will I write here the configuration snipplet in JSON Syntax.
5758

5859
[source,json]
5960
----
@@ -72,7 +73,7 @@ will I write here the config in JSON Syntax.
7273
A full working example is in
7374
`docker-files/opt/webroot/config/Caddyfile-upload.json`
7475

75-
### Caddyfile
76+
=== Caddyfile
7677

7778
Here a example Caddyfile which expects that the environment variable
7879
`APPPORT` is set.
@@ -95,7 +96,7 @@ Here a example Caddyfile which expects that the environment variable
9596
@mypost method POST
9697
upload @mypost {
9798
dest_dir tmp-upl
98-
max_form_buffer 1G
99+
max_form_buffer 1G
99100
max_filesize 4MB
100101
response_template templates/upload-resp-template.txt
101102
}
@@ -106,7 +107,7 @@ Here a example Caddyfile which expects that the environment variable
106107
}
107108
----
108109

109-
## build
110+
== build
110111

111112
[source,shell]
112113
---
@@ -115,9 +116,9 @@ xcaddy build --with github.com/kirsch33/realip \
115116
--with github.com/git001/caddyv2-upload
116117
---
117118

118-
## run
119+
== run
119120

120-
### cli
121+
=== cli
121122

122123
[source,shell]
123124
---
@@ -126,7 +127,7 @@ APPPORT=:2011 ./caddy run \
126127
-config Caddyfile-upload.json
127128
---
128129

129-
### docker
130+
=== docker
130131

131132
You can get this image from docker hub
132133

@@ -146,7 +147,7 @@ docker run --name caddy-test --rm \
146147
docker.io/me2digital/caddyv2-upload:latest
147148
---
148149

149-
## example cli
150+
== example cli
150151

151152
When you run the Image with port 8888 can you use curl or any other
152153
tool to post (upload) files
@@ -191,4 +192,9 @@ http.request.host {{placeholder "http.request.host" }}
191192
192193
http.upload.filename: {{placeholder "http.upload.filename"}}
193194
http.upload.filesize: {{placeholder "http.upload.filesize"}}
194-
----
195+
----
196+
197+
== Background informations
198+
199+
The **max_form_buffer** paramater will be directly passed to https://cs.opensource.google/go/go/+/refs/tags/go1.18.2:src/mime/multipart/formdata.go;l=34;drc=7791e934c882fd103357448aee0fd577b20013ce[readForm] function and is used to check if the uploaded file should be saved temporarly on disk or keep it in the memory. This have dicret impact into the performance and disk usage of that module. Keep in mind when this paramter is low and the upload is a big file then will be there a lot of disk io.
200+

0 commit comments

Comments
 (0)