This is necessary since the Device class does not hold a reference to
its inode (because there could be multiple), and thus doesn't override
File::stat(). For simplicity, we should just always stat via the inode
if there is one, since that shouldn't ever be the wrong thing.
This partially reverts #7867.
This enables the WebServer to run protected by a username and password.
While it isn't possible to access such a protected server from inside
Serenity as of now (because neither the Browser nor pro(1) support
this), this may very well be the case in the future. :^)
This patch adds two new static methods to HttpRequest.
get_http_basic_authentication_header generates a "Authorization" header
from a given URL, where as parse_http_basic_authentication_header parses
an "Authorization" header into username and password.
This moves the configuration of the web server, which currently only
consists of the root path, into a new class, Configuration. Since the
configuration is global and not per client, it is accessed by a
singleton getter.
This change simplifies future extensions of the configurable parameters.
This changes the Client::set_error_response() to not take a "message"
anymore. It now uses the canonical reason phrase which is derived from
the response code.
This adds trailing slashes to all links to directories (when listing the
directory contents). This avoids the redirect that would otherwise
happen when browsing to those directories.
In the web server root directory, ".." has to be handled specially,
since everything above it does not exist from the point of view of the
user. The most sensible thing to do is to make ".." equal to ".". This
is also what ls(1) does for "/" and what "http://localhost/../"
evaluates to.
This also fixes a bug where stat() would fail on the directory above the
root directory, since it hasn't been unveiled for the process.
The `--openssldir` parameter was causing OpenSSL to search for its
resources in the wrong location, e.g.:
`/serenity/Build/i686/Root/usr/local/ssl/...`
By using `--install_prefix`, the build system understands where to put
the OpenSSL files and does not leak the build path into the compiled
binaries.
Previously we would not block the caller until the connection was
established and would instead return EPIPE for the first send() call
which then likely caused the caller to abandon the socket.
This was broken by 0625342.
The addition of an is_generator parameter broke this, as is_strict was
being passed in, causing an assertion.
This is being addressed by changing it to an enum in #7981, but in the
meantime let's just fix these two cases.
20.5.1.1 Error ( message )
When the Error function is called with argument message, the
following steps are taken:
[...]
3b. Let msgDesc be the PropertyDescriptor {
[[Value]]: msg,
[[Writable]]: true,
[[Enumerable]]: false,
[[Configurable]]: true
}.
3c. Perform ! DefinePropertyOrThrow(O, "message", msgDesc).
The FunctionPrototype is correct for ErrorConstructor itself:
20.5.2 Properties of the Error Constructor
The Error constructor:
- has a [[Prototype]] internal slot whose value is
%Function.prototype%.
However, not for all the other "NativeError" constructors:
20.5.6.2 Properties of the NativeError Constructors
Each NativeError constructor:
- has a [[Prototype]] internal slot whose value is %Error%.
Non-RangeError exceptions can be thrown by user implementations of
valueOf (which are called by to_index), and the specification disallows
changing the type of the thrown error.
The second argument (the default constructor) and the return value have
to be constructors (as a result functions), so we can require that
explicitly by using appropriate types.
The `c_iflag` and `c_oflag` fields were swapped in the source code which
caused the bit values to be interpreted as the wrong flag. It was a
stupid mistake on my part.
This patch adds a CallType to the Bytecode::Op::Call instruction,
which can be either Call or Construct. We then generate Construct
calls for the NewExpression AST node.
When executed, these get fed into VM::construct().
This adds a new PushLexicalEnvironment instruction that creates a new
LexicalEnvironment and pushes it on the VM's scope stack.
There is no corresponding PopLexicalEnvironment instruction yet,
so this will behave incorrectly with let/const scopes for example.
This replaces Bytecode::Op::EnterScope with a new NewFunction op that
instantiates a ScriptFunction from a given FunctionNode (AST).
This is then used to instantiate the local functions directly from
bytecode when entering a ScopeNode. :^)