Hi Andy, Yes, I forgot about ZnZincServerAdaptor when refactoring/changing ZnMimeType>>#= - sorry about that. The solution is actually quite easy: ZnMimeType>>#match: does a comparison while ignoring additional mime type parameters like charset, in addition to its wild card matching. So the patch then would be: ZnZincServerAdaptor>>requestFieldsFor: aZincRequest | fields | fields := WARequestFields new. (aZincRequest method = #POST and: [ aZincRequest hasEntity ]) ifTrue: [ (aZincRequest entity contentType match: ZnMimeType applicationFormUrlEncoded) ifTrue: [ fields addAll: aZincRequest entity fields ]. (aZincRequest entity contentType match: ZnMimeType multiPartFormData) ifTrue: [ fields addAll: (self convertMultipart: aZincRequest entity) ] ]. ^ fields If you confirm that this works, I will check in the change later today. Thanks again for the cristal clear bug report ! Regards, Sven On 04 Jun 2013, at 10:34, Andy Kellens <akellens@vub.ac.be> wrote:
Hi,
Yesterday, I stumbled across a bug when using the Zinc Seaside adaptor that resulted in that the post fields of a request were not present in the WARequest. I found out that the problem occurred when converting a Zinc request into a WARequest.
More particular: ZnZincServerAdaptor>>requestFieldsFor: aZincRequest | fields | fields := WARequestFields new. (aZincRequest method = #POST and: [ aZincRequest hasEntity ]) ifTrue: [ aZincRequest entity contentType = ZnMimeType applicationFormUrlEncoded ifTrue: [ fields addAll: aZincRequest entity fields ]. aZincRequest entity contentType = ZnMimeType multiPartFormData ifTrue: [ fields addAll: (self convertMultipart: aZincRequest entity) ] ]. ^ fields
This method checks if the Mime Type is either applicationFormUrlEncoded or multiPartFormData in order to extract the post fields.
Recently, ZnMimeType>>= got changed from: ZnMimeType>>= other ^ (self class == other class) and: [ self main = other main and: [ self sub = other sub ] ]
to: ZnMimeType>>= other ^ (self class == other class) and: [ self main = other main and: [ self sub = other sub and: [ self hasParameters not & other hasParameters not or: [ self parameters = other parameters ] ] ] ]
As my request had an additional parameter charset=utf-8, the equality with ZnMimeType applicationFormUrlEncoded failed and hence the fields were not extract.
While I assume that the comparison of the Mime type parameters in #= is there for a good reason, and the best way to fix this problem is to change the #requestFieldsFor: method in order to match the Mime type differently, I wanted to briefly check with the mailing list before opening an issue + submitting a patch.
Kind regards,
Andy
-- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org