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

Add HTTP POST support to the HTTP client #151

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

tomvanbraeckel
Copy link
Contributor

I'm using this for of my (experimental, but working!) "find games" functionality, where one retro-go device connects to another's wifi hotspot and recursively "finds" (and downloads) ROMs that it doesn't have yet.

The idea is that kids can easily share games with each other this way, especially self-made GameBoy Color games as it looks like there will be a GBStudio workshop at Fri3d camp!

I'm thinking of giving the users a high-level choice of which ROM folders to check (/sd/roms/ or /sd/roms/gbc/ or /sd/roms/nes or /sd/roms/gb or /sd/roms/doom etc) to make it faster and more selective, in case there are many games.

Even better would be to to create a nice new "remote file browser" tab that properly allows you to browse another retro-go's (or in general. any webserver's) files. This could use the default http://192.168.4.1/ (assuming you're connected to another retro-go's wifi hotspot) but it would be nice to have some way of configuring this URL. So a method of entering an IP address or generic text on the retro-go would be cool... dream, dream, dream!

This is useful to know what's going on without having to dig deep.

For instance, the retro-go HTTP API will return 404 to:
http://192.168.4.1/%2fsd%2fcrash.log
but not to:
http://192.168.4.1/sd%2fcrash.log

But without seeing the status code, it's kind of guess work
as to why exactly rg_network_http_open() failed.

Or it will not provide a Content-Length field for download file requests,
but it *will* assume that other HTTP servers do provide it, such as in
updater.c's download_file() to show the total bytes to download.

An informational "content length: 0" would have helped to understand this.
Using the unused rg_http_cfg_t for this, assuming that's what it is for.

If rg_http_cfg_t->post_data is provided, the http client will do a POST request with that data.
@tomvanbraeckel tomvanbraeckel changed the base branch from master to dev August 7, 2024 10:59
@tomvanbraeckel tomvanbraeckel changed the title Http client add post support Add HTTP POST support to the HTTP client Aug 7, 2024
@ducalex
Copy link
Owner

ducalex commented Aug 7, 2024

It's a good idea to add POST support and your adhoc/p2p networking plans sound ambitious and pretty fun!

@ducalex ducalex force-pushed the dev branch 12 times, most recently from 8874d4b to 3d3cbb0 Compare August 30, 2024 02:43
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