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

Less restrictive checks in MTOMDecoder #230

Merged
merged 5 commits into from
Aug 13, 2023

Conversation

giovanni-orciuolo
Copy link
Contributor

Makes more MTOM-based services work correctly. Sometimes, some services do not use the exact names in their headers.

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

What’s the content type value coming from your service? I believe we should be able to use strings.HasPrefix here.

@giovanni-orciuolo
Copy link
Contributor Author

What’s the content type value coming from your service? I believe we should be able to use strings.HasPrefix here.

I get this string:
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";

So I believe we could theoretically use application/xop+xml as a prefix

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

Right, I have always seen the type and subtype first and extra attributes coming after.

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

@giovanni-orciuolo
Copy link
Contributor Author

Alright, so can I make a commit with HasPrefix and merge?

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

Yes

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

If we were to do this better, it would be by using a more robust parser: https://pkg.go.dev/mime

@giovanni-orciuolo
Copy link
Contributor Author

Yeah, but I believe the only 2 cases we have at the moment are application/soap+xml and text/xml in start-info. Should more cases arise, we should consider using that library

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

We also have the one raised in #217

@c4milo
Copy link
Member

c4milo commented Dec 2, 2021

The one coming in the mtom header.

@giovanni-orciuolo
Copy link
Contributor Author

I think we both had the exact same problem and solved it in the same way. The commits do the same thing. You can choose which one your prefer to merge ^^

@giovanni-orciuolo
Copy link
Contributor Author

Can you merge this PR into the base library? I need it in a production environment

@giovanni-orciuolo
Copy link
Contributor Author

I added more comprehensive checks inside the getBinaryFields function, in order to account for a vast amount of cases in the XML response (e.g. slices, pointers, etc...) in order to populate the binary fields.

@giovanni-orciuolo
Copy link
Contributor Author

@c4milo Can we merge this?

@c4milo c4milo merged commit 039e0b6 into hooklift:master Aug 13, 2023
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 this pull request may close these issues.

2 participants