TASEmulators / TASEmulators/BizHawk
HTTP in Lua scripting requires command-line initialization
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
Summary
When using Lua HTTP functions such as comm.httpGet and comm.httpPost, by default these give the error "HTTP was not initialized, please initialize it via the command line." I was unable to find documentation on the error message, but I was able to look into the code to figure out what command-line arguments are needed. For whatever reason, these functions require a URL to be set from the command-line. Setting these via the command-line like emuhawk --url_get=. --url_post=. resolves the error and allows the HTTP functions to work properly. It doesn't seem to matter what the URLs are set to so long as they are set. Setting them within Lua using the httpSetGetUrl and httpSetPostUrl functions also does not resolve the error, these must be set in the command line.
As of right now, this issue makes it difficult to use the built-in HTTP functionality for, say, implementing online multiplayer. If this is unintentional (I don't know why these functions would require global URLs), this is a bug and should be resolved. If it is intended to require command-line initialization for security or other reasons, that should at least be documented so developers can be aware of this limitation.
Repro
- Open BizHawk normally.
- Run a Lua script using the comm.httpGet or comm.httpPost functions.
- Observe the error message.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the comm.httpGet and comm.httpPost entry points and trace how --url_get and --url_post initialize HTTP. Reproduce the error with a normal BizHawk launch, then determine whether Lua initialization should work or whether the command-line requirement needs documentation; done means the intended behavior is implemented and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, lua
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100