Skip to content

Conversation

@WilsontheWolf
Copy link
Member

@WilsontheWolf WilsontheWolf commented Feb 20, 2025

This adds a WIP implementation of the https module that works cross platform without having to ship native libs. It uses one of 2 backends (the actual https module for windows, and libcurl for other platforms).

Basic example

local https = require "SMODS.https"

print(https.request("https://example.com"))

API differences from upstream lua https:

  • Ships with a default user agent
  • Additional checks on some values
  • Proper error messages (curl backend only)

This has been tested on the following systems:

  • Windows (via wine)
  • Linux native build (Fedora 41)
  • MacOS (Ventura intel)

Needs additional testing

  • MacOS (No Xcode, No brew or other package manager) (Need to check if curl is actually provided by macos)
  • iOS (Not an offically support platform) Doesn't work

If MacOS doesn't work, I can implement a version using objc api's.

I also want to implement an a function to make a request on a background thread, but that will come later (possibly other pr).

TODO Before Merge:

  • Make changes for luals
  • Make wiki page
  • Get someone with a MacOS device not setup for dev stuff to test (fuck it we ball)
  • (optional) Async implementation

@WilsontheWolf WilsontheWolf marked this pull request as ready for review February 25, 2025 00:00
Copy link
Member

@Aurelius7309 Aurelius7309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Aurelius7309 Aurelius7309 merged commit 500bba5 into main Feb 25, 2025
2 checks passed
@Aurelius7309 Aurelius7309 deleted the experimental-https branch March 21, 2025 12:40
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.

3 participants