Skip to content

Conversation

@fghalasz
Copy link
Member

This PR adds a Python HTTP File server running in every invocation of Run Medley.

The HTTP Server for a specific Online Medley invocation can be accessed at https://online.interlisp.org:<WEBFILES_PORT>,
where <WEBFILES_PORT> can be found within the Medley run using (UNIX-GETENV "OIO_WEBFILES_PORT")

The HTTP Server serves files from MEDLEY_USERDIR/webfiles - within Medley this directory is PSEUDONAMEd {WEBFILES}

A webfile is any file stored in {WEBFILES} that can be accessed by a web browser.

The Medley function (Online.WebfileURL WebfilePath) returns a URL that can be used to access the named webfile from any browser. The WebfilePath is just the portion of the path underneath {WEBFILES}.

The Medley function (Online.OpenWebfile WebfilePath) opens a new browser page showing the specified webfile.

The intended use of the HTTP server is to allow Medley to display in a browser tab, either HTML or PDF files created by HARDCOPY functions.

This PR is currrently active on the dev system https://online.interlisp.org:8081

…hich will be loaded and run when Online Medley starts up - accessible only via the online.interlisp.org/guest scheme.
Signed-off-by: Frank Halasz <frank@halasz.org>
Signed-off-by: Frank Halasz <frank@halasz.org>
…rl if wget is not present; ShellHttpGet now resides in the file library/ONLINEUTILS (rather than library/UNIXUTILS) and is loaded only into the Online Medley docker image and not the standard Medley loadups
…he https server starts when Medley starts and feeds pages from MEDLEY_USERDIR/webfiles. Meant to allow Medley to open locally produced and stored html files in a web browser
…rather than the Dockerfile_medley since the file system is preserved across invocations and may have been created before the MEDLEY_WEBDIR facility came into being.
…stem in a browser via the OIO Https server. webfiles are stored in {WEBFILES}.
@fghalasz fghalasz merged commit 9ae1f13 into main Dec 15, 2025
1 check passed
@pamoroso
Copy link
Member

If I evaluate (Online.OpenWebfile '{WEBFILES}test.html) or (Online.OpenWebfile 'webfiles>test.html) or (Online.OpenWebfile '{WEBFILES}test.html) I get a web page with this error and the Medley session ends:

Error response

Error code: 404

Message: File not found.

Error code explanation: HTTPStatus.NOT_FOUND - Nothing matches the given URI.

This happens on both Medley Online and the staging server. The file test.html does exist under webfiles.

@pamoroso
Copy link
Member

On Medley Online (Online.WebfileURL 'webfiles>test.html) returns https://online.interlisp.org:43003/webfiles>test.html, (Online.WebfileURL '{LI}webfiles>test.html) returns https://online.interlisp.org:43003/{LI}webfiles>test.html, and (Online.WebfileURL '{WEBFILES}test.html) returns https://online.interlisp.org:43003/{WEBFILES}test.html

@pamoroso
Copy link
Member

I don't know whether it's related, but pasting text with Meta-V into a Medley Online or staging server Exec yields this error even if xclip is available:

Error: target STRING not available
Can't find package Error to look up symbol

The current Medley Online sysout is dated 10-Dec-2025 01:25:45, so it may not have picked up the latest changes yet.

@nbriggs
Copy link

nbriggs commented Dec 15, 2025

@pamoroso - I think that needs a separate issue.

Medley is passing "xclip -o -selection clipboard" to the shell, and xclip is responding with "Error: target STRING is not available", that gets stuffed into whatever Lisp window is active, and if that happens to be an exec, you get "Can't find package Error to look up symbol" because the input contained "Error:" and there is no such package. If you happen to paste it into a TEdit window you'd just see that string.

Diagnosed by tracing IL:CREATE-PROCESS-STREAM and then executing the same command in a chat-to-shell window. Part of the problem is because the invocation of xclip does not distinguish between the desired output on stdout, and the error output on stderr, and doesn't alter its behavior based on whether the exit status is 0 (success) or 1 (failure). If you run it with -verbose it says:

% xclip -verbose -o -selection clipboard
Connected to X server.
Using selection: XA_CLIPBOARD
Using UTF8_STRING.
Error: target STRING not available

@pamoroso
Copy link
Member

Thanks, I opened issue #2416.

@nbriggs
Copy link

nbriggs commented Dec 15, 2025

For the WEBFILES URL issue - I'd bet it's because you're giving it ">" as the directory separator instead of "/", and the URL handling isn't doing the conversion. I think there should probably be an issue for either missing documentation or missing code.

@fghalasz
Copy link
Member Author

@pamoroso Online.WebfileURL takes only a file path for a file below {WEBFILES}. So the given path should never have a HOST component like {LI} or {WEBFILES}. And the path "webfiles>test.thml" refers to {WEBFILES}webfiles/test.html". The test.hmtl file is (should be) at {WEBFILES}test.html.

I will update code to error out if given a path with a HOST component. Also I will fix the ">" to "/" issue.

Are you sure there is no test.html in your setup if you cd {WEBFILES} and then ls. If not then try with a guest login. It is possible that things are not setting up correctly for not first time logins online.

@pamoroso
Copy link
Member

(Online.OpenWebfile 'test.html) works as expected in a guest session on the staging server. When signed into my account on the production Medley Online, the same call opens the HTML file in a new tab and disconnects the Medley session, dropping back to the Medley Online login page.

@pamoroso
Copy link
Member

(Online.OpenWebfile 'test.html) disconnects the session also when logged in as a guest on the production Medley Online. However, Medley Online hasn't been rebuilt since the PR was merged, so the setup may be inconsistent.

@pamoroso
Copy link
Member

@fghalasz I tried (Online.OpenWebfile 'test.html) in Medley Online 14-Jan-2026 01:26:28 while logged in and it works with no issues. I use Firefox on Linux Mint 22.1 Cinnamon.

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.

4 participants