amazon S3 upload API is sensitive to http post parameter ordering -


i've created bucket policy makes mandatory specify content-type of object being uploaded. if specify content-type after file element, (example below)

<form action=".."> ... <input type='file' name='file' /> <input name='content-type' value='image/jpeg' /> <input type='submit' /> </form> 

it returns following error

<error>     <code>accessdenied</code>     <message>invalid according policy: policy condition failed: ["starts-with", "$content-type", ""]</message>     <requestid>15063eb427b4a469</requestid>     <hostid>yezapf4z2inaafhcqyq4oolvkdwnsrwqqhnyg6jm5hpqwsoltptuk0t9hn+zkbebk+rp4s5nfvs=</hostid> </error> 

if specify content-type before file element, upload works expected. encountered behaviour first time. have few questions regarding it.

  1. is part of specification clients , intermediate proxies supposed maintain order of http post params? please point me it.

  2. why make api aware of such ordering? in particular case can guess file can huge , unless seeing expected params before, should return failure. please correct me if understanding not correct.

it part of spec parts sent ordered in form. there no reason believe reordering intermediate proxy allowed.

the form data , boundaries (excluding contents of file) cannot exceed 20k.

...

the file or content must last field in form.

http://docs.aws.amazon.com/amazons3/latest/api/sigv4-httppostforms.html#sigv4-httppostformfields

the logical assumption design allows s3 reject invalid uploads early.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -