Age | Commit message (Collapse) | Author |
|
Here, we try to use the new String type for everything internal,
keeping the public interface and the interface to other code the same.
|
|
We've also pulled out the default root path instead of folding it in
with the receiving variables, so that it's uniform across all options
with default values.
|
|
Now, there is nothing that can react to `set_...()` calls, so
offering this possibility can cause wrong assumptions as to what one
can do as soon as a WebServer instance has launched.
The main program can still decide whether to supply the optional
credentials or not, but this way, the configuration can become a Value
Object that won't change after initial creation.
|
|
The concept of a "document root" seems to be a de-facto industry
standard and doesn't make you wonder what kind of root path is meant.
|
|
|
|
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.
One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
|
|
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
|
|
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.
Also included are changes to readd now missing dependencies to tools
that actually need them.
|
|
This patch adds a hyperlink that can be hovered over and clicked on to
open the WebServer's index page in Browser.
|
|
Split the path from querystring when determining the requested resource.
|
|
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).
No functional changes.
|
|
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).
No functional changes.
|
|
This affects BufferedSeekable::read_until() and ::read_until_any_of().
For the reasoning, see the previous commit about Core::Stream::read().
|
|
|
|
This makes the browser know how much data it should expect.
|
|
|
|
|
|
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
|
|
|
|
As per previous discussion, it was decided that the Stream classes
should be constructed on the heap.
While I don't personally agree with this change, it does have the
benefit of avoiding Function object reconstructions due to the lambda
passed to Notifier pointing to a stale object reference. This also has
the benefit of not having to "box" objects for virtual usage, as the
objects come pre-boxed.
However, it means that we now hit the heap everytime we construct a
TCPSocket for instance, which might not be desirable.
|
|
This still not propagates errors properly, but is at least (more)
consistent with the codebase.
|
|
|
|
This is intended as a real-usecase test of the Serenity Stream API, and
seemed like a good candidate due to its low amount of users.
|
|
|
|
|
|
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
|
|
Only one place used this argument and it was to hold on to a strong ref
for the object. Since we already do that now, there's no need to keep
this argument around since this can be easily captured.
This commit contains no changes.
|
|
Previously when the WebServer sent an error page the browser would
show the raw HTML since we forgot to send the 'Content-Type' header
|
|
This adds component declarations so that users can select to not build
certain parts of the OS.
|
|
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 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.
|
|
Responding with some device files such as /dev/random never terminates,
so let's just refuse that.
|
|
|
|
This is necessary to avoid trying to destruct the on_ready_to_read
function from inside the function. This fixes #7810.
|
|
This also removes two unused headers.
|
|
This replaces all occurrences of those functions with the newly
implemented functions URL::percent_encode() and URL::percent_decode().
The old functions will be removed in a further commit.
|
|
These dbgln's caused excessive load in the WebServer process,
accounting for ~67% of the processing time when serving a webpage
with a bunch of resources like serenityos.org/happy/2nd/.
|
|
Similar to an invalid listen address, we should not fallback to the
default port (8000) but instead exit with an error.
|
|
|
|
With this we can make the Webserver listen on
another address than the default of "0.0.0.0".
|
|
The recent patch to LexicalPath allowed relative paths like ../ to work
in requests to WebServer. This wasn't too dangerous because of unveil,
but let's still fix this :^)
|
|
This sets the Pragma: no-cache header. Using Cache-Control would be
preferable but that's not part of the HTTP/1.0 standard.
|
|
There's no guarantee that the client has closed the socket for
writing. Instead we should just read until the first empty line.
Fixes #7064.
|
|
Nobody seems to use this particular feature, in fact there were some
bugs which were uncovered by removing operator bool.
|
|
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
|
|
...and make it an enum class so people don't omit "OpenMode".
|