Skip to content

Build only php -S, passthru(), redirect to server from symlink #7990

Closed
@guest271314

Description

@guest271314

Description

I only require built-in local server php -S localhost:8000 and passthru(), not the remainder of PHP.

Additionally I need to make requests to the local server using a symbolic link.

Are the above two requirements possible?

<?php 
  header('Vary: Origin');
  header("Access-Control-Allow-Origin: *");
  header("Access-Control-Allow-Methods: GET");
  header("Content-Type: application/octet-stream");
  header("X-Powered-By:");
  echo passthru("parec -d @DEFAULT_MONITOR@");
  exit();
}
let abortable = new AbortController();
let {signal} = abortable;
// 'chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt' 
// is symbolic link to http://localhost:8000
fetch('chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/test.txt', {signal})
.then((r) => r.body)
.then((readable) => readable.pipeTo(new WritableStream({
  write(v) {console.log(v) // do stuff},
  close() {console.log('Stream closed.')}
}))
.catch(console.warn);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions