Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boundary not found in Content-Type: multipart/formdata #9

Closed
nnamtug opened this issue Mar 10, 2017 · 0 comments · Fixed by Kong/kong#2215
Closed

boundary not found in Content-Type: multipart/formdata #9

nnamtug opened this issue Mar 10, 2017 · 0 comments · Fixed by Kong/kong#2215

Comments

@nnamtug
Copy link

nnamtug commented Mar 10, 2017

in function MultipartData.new(data, content_type), the boundary is searched by using the expression ";%s+boundary=(%S+)".

This works correctly for e.g. this Content-Type header:

Content-Type: multipart/form-data; boundary=AAAH...

But the whitespace after the semicolon is optional (and the pattern expects a whitespace). If the whitespace is not there, the field boundary is nil and parsing of the request will fail.

E.g. in when using Kong 0.8.3 with Oauth2 and a multipart upload, this fails as following:

share/lua/5.1/multipart.lua: in function 'decode'
share/lua/5.1/multipart.lua:112: in function 'Multipart'
share/lua/5.1/kong/plugins/oauth2/access.lua:93: in function 'retrieve_parameters'
share/lua/5.1/kong/plugins/oauth2/access.lua:359: in function 'parse_access_token'
share/lua/5.1/kong/plugins/oauth2/access.lua:412: in function 'execute'
share/lua/5.1/kong/plugins/oauth2/handler.lua:12: in function 'access'
share/lua/5.1/kong.lua:188: in function 'access'```

Solution: in multipart.lua:109 the value of boundary should also be found, if no whitespace is sent after the ; by the client in the value of the header Content-Type
thibaultcha pushed a commit to Kong/kong that referenced this issue Mar 16, 2017
The multipart header whitespace was obligatory, and is now optional.

See Kong/lua-multipart#9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant