vibe.d: How to get the conent of a file upload ?
wjoe
invalid at example.com
Fri Sep 18 11:54:24 UTC 2020
On Friday, 18 September 2020 at 11:44:39 UTC, Atwork wrote:
> On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote:
>> And if not, how is data processed with a 10mb file upload
>> followed by a few number fields ?
>> It needs to read all of the file data to get to the other data
>> fields, doesn't it ?
>
> Yes and no
Consider this:
> ~$ curl -F "temperature_log=@/var/log/temperatures.log" -F
> "field1=a" -F "field2+foo" 192.168.1.1:20222/temperature_upload
> ~$ nc -l 127.0.0.1 20222
>
> POST /temperature_upload HTTP/1.1
> Host: 192.168.1.1:20222
> User-Agent: curl/7.72.0
> Accept: */*
> Content-Length: 10486005
> Content-Type: multipart/form-data;
> boundary=------------------------c73c71472ff9e7d5
>
> --------------------------c73c71472ff9e7d5
> Content-Disposition: form-data; name="temperature_log";
> filename="/var/log/temperatures.log"
> Content-Type: application/octet-stream
>
> temp_1=22;temp_2=28
> temp_1=21;temp_2=25
>
> [ ... 10 MB of data ... ]
>
> --------------------------c73c71472ff9e7d5
> Content-Disposition: form-data; name="field1"
>
> a
> --------------------------c73c71472ff9e7d5
> Content-Disposition: form-data; name="field2"
>
> foo
> --------------------------c73c71472ff9e7d5--
How is vibe going to extract field1 and field2 without processing
the temperature_log field ?
More information about the Digitalmars-d-learn
mailing list