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

Reply via email to