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

Castle download support for httpbody/httpheaders for Android #584

Merged

Conversation

phomm
Copy link
Contributor

@phomm phomm commented Mar 19, 2024

No description provided.

@phomm
Copy link
Contributor Author

phomm commented Mar 19, 2024

@michaliskambi , hi, please review :)
Not sure about printing stack trace to log, could be removed if too verbose/insecure
Also not sure if packing/unpacking headers is fine enough, maybe need to apply some more strict rules and correlate to other platforms
As always, suggest corrections

@michaliskambi
Copy link
Member

Thank you for updating the PR, I see it and this is much appreciated. Sorry it's taking me so long, I will get to it -- I'll test and apply :)

@michaliskambi
Copy link
Member

michaliskambi commented May 6, 2024

Thanks again for patiently waiting for me and synchronizing with master :) Note: If you'll get emails from GitHub Actions about failures to build, don't worry, that's something I'm looking into (our 32-bit Raspberry Pi machine seems too slow to cope with our test demands).

@michaliskambi
Copy link
Member

Thanks again for being patient. I have just created the perfect Castle Game Engine application to test this PR -- see https://github.com/michaliskambi/castle-openai :) I will announce it around the weekend. Once I merge your PR, this application should automatically work also on Android.

michaliskambi added a commit to castle-engine/castle-openai that referenced this pull request May 27, 2024
The UI hanging was fixed.

Rocks on Android after castle-engine/castle-engine#584
…e with packing

Also remove log about them (already possible with Messaging.Log=true)
@michaliskambi michaliskambi merged commit 643c375 into castle-engine:master May 27, 2024
22 checks passed
@michaliskambi
Copy link
Member

Thank you again! Tested, reviewed and merging. https://github.com/castle-engine/castle-openai rocks on Android thanks to you!

I pushed now tiny improvements:

  1. I updated the comment "TODO: We may change this behavior in the future, to make it such that..." to better explain what I imagine for the future.

    I saw that you made a fix to previous invalid comment (it was "HttpPostData will automatically override HttpPostData"...), but I wanted to outline a different future :)

  2. Removed printing HTTP headers to log (one can debug them anyway by Messaging.Log := true from program, and I was afraid that showing them by default may be too risky -- HTTP headers may expose some passwords / API keys to anyone looking at log).

  3. As for

Also not sure if packing/unpacking headers is fine enough, maybe need to apply some more strict rules and correlate to other platforms

Good point -- for now I just added a check that provided header key/value just doesn't contain ":". This way, if this is ever a real problem, user will get a clear exception saying what's wrong.

I noticed you made other improvements to the Java side (comment "TODO: we need to consider a way to deal with binary data", more obvious code thanks to connection.connect() and connection.getResponseCode() on own lines, using connection.getErrorStream() ) and I like them all, thank you. I don't really have an opinion whether the change to display PrintStackTrace is too verbose or not -- maybe I'll make an opinion once I see it :), for now I leave it as you did, no complaints from me.

@phomm
Copy link
Contributor Author

phomm commented May 27, 2024

Thanks, night-superhero 😅
Regarding comments - fully agree, bc you have better vision for future.
Regarding logging request - totally agree, it is a security thing, I think I had idea to make it configurable, but your method is really better.
Regarding headers validation - explicit one is way better than naive, and I didn't elaborate this, unfortunately, and I will pay attention in future!
And I agree, let's test and see if StackTrace has value

AND overall Thank you for reviewing and merging, I know you have such a wide scope, but working stoutly for years !

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.

None yet

2 participants