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

value issue in additional header #5

Closed
feifangit opened this issue Mar 14, 2014 · 2 comments
Closed

value issue in additional header #5

feifangit opened this issue Mar 14, 2014 · 2 comments

Comments

@feifangit
Copy link

I'm new to LUA, I tried to upload file with some meta data with curl command curl -i -X POST -F "uuid=123" -F "fileobj=@1.txt http://somewhere"

But the value of uuid which is "123" seems be truncated in the the value, and even the line.

["Content-Disposition","form-data; name=\"uuid\"","Content-Disposition: form-data; name=\"uuid\""]

I noticed there're double \r\n pairs located between uuid and its value.

020: 39 36 63 64 63 33 39 31 35 33 0d 0a 43 6f 6e 74 96cdc39153..Cont
0030: 65 6e 74 2d 44 69 73 70 6f 73 69 74 69 6f 6e 3a ent-Disposition:
0040: 20 66 6f 72 6d 2d 64 61 74 61 3b 20 6e 61 6d 65  form-data; name
0050: 3d 22 75 75 69 64 22 0d 0a 0d 0a 31 32 33 0d 0a ="uuid"....123..
0060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 30 62 --------------0b
0080: 39 36 63 64 63 33 39 31 35 33 0d 0a 43 6f 6e 74 96cdc39153..Cont
0090: 65 6e 74 2d 44 69 73 70 6f 73 69 74 69 6f 6e 3a ent-Disposition:
00a0: 20 66 6f 72 6d 2d 64 61 74 61 3b 20 6e 61 6d 65  form-data; name
00b0: 3d 22 66 69 6c 65 6f 62 6a 22 3b 20 66 69 6c 65 ="fileobj"; file
00c0: 6e 61 6d 65 3d 22 31 2e 74 78 74 22 0d 0a 43 6f name="1.txt"..Co
00d0: 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 ntent-Type: text
00e0: 2f 70 6c 61 69 6e 0d 0a 0d 0a                   /plain....

BTW. any better solution to obtain the extra information(you defined as header) from multipart uploading request?

@agentzh
Copy link
Member

agentzh commented Mar 14, 2014

@feifangit This is the expected behavior of curl's -F option. For -F "uuid=123", curl generates something like the following:

------------------------------4471b0132daf
Content-Disposition: form-data; name="uuid"

123
------------------------------4471b0132daf--

So the value 123 becomes the content body of the corresponding part.

@feifangit
Copy link
Author

Thanks for you explanation, you enlightened me :P

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

No branches or pull requests

2 participants