Multipart form posts with files (testing with JMeter)

As mentioned below, ruby on rails does not seems to treat the
multipart form posts as based in RFC 2388.
e.g. .Each part of a multipart/form-data is supposed to have a content-
type.

<

I have a problem on simulating with JMeter the multipart form post
against rails application.
Can anyone fix this?

Okay, nobody in rails communication try to let rails follow RFC 2388.
I won’t use rails anymore. It’s sucks!

On Oct 17, 1:45am, Cocy N [email protected] wrote:

As mentioned below, ruby on rails does not seems to treat the
multipart form posts as based in RFC 2388.
e.g. .Each part of a multipart/form-data is supposed to have a content-
type.

Have you tried it? Works okay for me. I’ve just created a form with
two files, and uploaded them both. In the debugger I output their
content types; one was “application/pdf”, the other
“application/msword”.

I have a problem on simulating with JMeter the multipart form post
against rails application.

So you don’t have a problem with Rails, but with JMeter?.. If you
posted what the “problem” you were having is, maybe someone could
help. Any errors messages you can post? Or details about what you did;
how you did it; what you expected to happen; and what actually did
happen?

Can anyone fix this?

Maybe a JMeter forum would be a better place to ask?

On 22 October 2010 22:27, Cocy N [email protected] wrote:

Okay, nobody in rails communication try to let rails follow RFC 2388.
I won’t use rails anymore. It’s sucks!

?!
Probably best.

On Oct 23, 11:04pm, Michael P. [email protected] wrote:

On Oct 17, 1:45am, Cocy N [email protected] wrote:

As mentioned below, ruby on rails does not seems to treat the
multipart form posts as based in RFC 2388.
e.g. .Each part of a multipart/form-data is supposed to have a content-
type.

Have you tried it? Works okay for me. I’ve just created a form with
two files, and uploaded them both. In the debugger I output their
content types; one was “application/pdf”, the other
“application/msword”.

Have you read the URL page that I’ve posted?
If so, how come you don’t understand what the author of the page and
I’ve described?
Have you checked the raw packet carefully?

Maybe a JMeter forum would be a better place to ask?

On 22 October 2010 22:27, Cocy N [email protected] wrote:

Okay, nobody in rails communication try to let rails follow RFC 2388.
I won’t use rails anymore. It’s sucks!

?!
Probably best.

Okay it’s good for me.
I don’t know Ruby and I don’t even want to know Ruby/Rails, and since
Rails seems doesn’t understand the form-data I’ve asked help to this
community, but enough is enough.
I’ve customized JMeter by myself to go to forward my task.
Now I don’t need help from Rails community.

On 23 October 2010 16:05, Cocy N [email protected] wrote:

Have you read the URL page that I’ve posted?

Yes. IIRC, the OP complained that Rails worked perfectly from his
browser, but when using some testing software, the results were not
the same.

If so, how come you don’t understand what the author of the page and
I’ve described?

You didn’t describe anything - you said “Each part of a
multipart/form-data is supposed to have a content-type.” and as far as
I can see when I run a form post, it does.

Have you checked the raw packet carefully?

No - why would I want to?! That’s what I’m abstracting stuff to Rails
for.

Okay it’s good for me.
I don’t know Ruby and I don’t even want to know Ruby/Rails, and since
Rails seems doesn’t understand the form-data I’ve asked help to this
community, but enough is enough.

Rails does understand the form as far as I can see. There seems to
be a problem with the implementation of the form by the testing
software. Hardly Rails’ fault!

I’ve customized JMeter by myself to go to forward my task.

Right - you fixed what was wrong, That’s good to hear… there was
nothing wrong with the Rails app…

Now I don’t need help from Rails community.

Because you didn’t have a Rails problem.

BTW Did you read RFC 2388 rather than just punting on the assertions
from the Stackoverflow post? I quote: “As with all multipart MIME
types, each part has an optional ‘Content-Type’”. Optional…

On Oct 23, 11:04 pm, Michael P. [email protected] wrote:

On Oct 17, 1:45 am, Cocy N [email protected] wrote:

As mentioned below, ruby on rails does not seems to treat the
multipart form posts as based in RFC 2388.
e.g. .Each part of a multipart/form-data is supposed to have a content-
type.
Have you tried it? Works okay for me. I’ve just created a form with
two files, and uploaded them both. In the debugger I output their
content types; one was “application/pdf”, the other
“application/msword”.

Have you read the URL page carefully that I’ve posted?
If so, how come you don’t understand what the author of the page and
I’ve described?
Have you checked the raw packet by yourself? I mean not the output
from the debugger, but the raw packet.

Maybe a JMeter forum would be a better place to ask?
On 22 October 2010 22:27, Cocy N [email protected] wrote:

Okay, nobody in rails communication try to let rails follow RFC 2388.
I won’t use rails anymore. It’s sucks!
?!
Probably best.

Fine, it’s good for me.
I don’t know Ruby and I don’t even want to learn Ruby/Rails, and
since
Rails seems doesn’t understand the correct multipart request data,
I’ve asked help to this community, but I don’t need help now.
I’ve customized JMeter by myself to let my task go forward, even
knowing
this change is not the right change.

On Oct 24, 12:25am, Michael P. [email protected] wrote:

On 23 October 2010 16:05, Cocy N [email protected] wrote:
BTW Did you read RFC 2388 rather than just punting on the assertions
from the Stackoverflow post? I quote: “As with all multipart MIME
types, each part has an optional ‘Content-Type’”. Optional…

I quote :

"4.5 Charset of text in form data
Each part of a multipart/form-data is supposed to have a content-type.
"

On 23 October 2010 16:34, Cocy N [email protected] wrote:

I quote :
“4.5 Charset of text in form data
Each part of a multipart/form-data is supposed to have a content-type.”

Yes, I saw that too… and wondered if it was arguable that the RFC
contradicts itself.

But… as far as I can rationalise:
Multipart data has to be turned into something… if you post a mix of
text fields and files, if one of those files is a text file, both
content-types would be “text/plain”, so how would a server know which
started on the form as a file-field and which was a text-field?
It strikes me that the developers have to make assumptions, and it
seems that a sensible assumption is that if a user-agent sends a
multipart form; those elements without content-type (seeing as part of
the RFC does say they’re optional) are form fields, and those with
it are files.
It also strikes me that since every browser (or at least the dozen or
so I’ve tested it with) seems to post multipart forms without
content-type for fields, this may be a common conclusion, and if one
testing application goes the other way, and sends up ambiguous data
(is it a text field, or a text file?) while expecting to get the right
thing back; using Occams Razor, can it be that favourable that all the
other browsers and frameworks are wrong?

Unless I’m overlooking something deep in the protocol…

On Oct 24, 12:46am, Michael P. [email protected] wrote:

On 23 October 2010 16:34, Cocy N [email protected] wrote:

Multipart data has to be turned into something… if you post a mix of
text fields and files, if one of those files is a text file, both
content-types would be “text/plain”, so how would a server know which
started on the form as a file-field and which was a text-field?

I think this might be the answer (solution?) for your question.
I quote :
“In the case where a field element is text, the charset
parameter for the text indicates the character encoding used.”

I don’t know how the server distinguishing if the data is text or text-
file, though.

thing back; using Occams Razor, can it be that favourable that all the
other browsers and frameworks are wrong?

Yes, as you mentioned, posting multipart forms without content-type
(and character encoding if it’s text) for fields may be a common
conclusion.
But since it’s optional, I think, it could be (and could not be)
there…

Anyways, I got through my problem, so I don’t care at this time.

BTW, thanks for your reply.
You are the only one who replied to my post :slight_smile:

On Oct 24, 1:57am, Michael P. [email protected] wrote:

Well, it is Saturday - don’t people deserve a day off! :slight_smile: and… I
hazard a guess that the tone of your original posts may have
dissuaded some people from attempting to help… just a thought. NOI.

My apologies for impoliteness in the original posts…
Thank you again!

On 23 October 2010 17:28, Cocy N [email protected] wrote:

BTW, thanks for your reply.

You’re welcome. After thinking about it for a bit, it is an
interesting issue.

You are the only one who replied to my post :slight_smile:

Well, it is Saturday - don’t people deserve a day off! :slight_smile: and… I
hazard a guess that the tone of your original posts may have
dissuaded some people from attempting to help… just a thought. NOI.

Regards,