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 simple http client and server examples #903

Merged

Conversation

adamfeuer
Copy link
Contributor

@adamfeuer adamfeuer commented Mar 15, 2023

Adds simple http client and server examples:

  • http client can get the contents of a URL specified on the command line; or print usage if no URL is givien.
  • http server serves a very simple HTML page with a single number that is incremented on every request. (Adapted from the source code documentation.)

Copy link
Owner

@ashinn ashinn left a comment

Choose a reason for hiding this comment

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

Thanks!

(let ((url (car (cdr (command-line)))))
(if (> (string-length url) 0)
(begin
(display (read-string 65536 (http-get url)))
Copy link
Owner

Choose a reason for hiding this comment

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

Note you can use port->string here.

@ashinn ashinn merged commit 8ea99a9 into ashinn:master Mar 15, 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.

None yet

2 participants