summaryrefslogtreecommitdiff
path: root/Userland/Services/WebServer
AgeCommit message (Collapse)Author
2022-12-26WebServer: Use new String type internally as much as possibleThomas Keppler
Here, we try to use the new String type for everything internal, keeping the public interface and the interface to other code the same.
2022-12-26WebServer: Use new String type for default option valuesThomas Keppler
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.
2022-12-26WebServer: Require document root and credentials as config init paramsThomas Keppler
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.
2022-12-26WebServer: Rename {real_}root_path to {real_}document_root_pathThomas Keppler
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.
2022-12-20AK: Stop using `DeprecatedString` in Base64 encodingJelle Raaijmakers
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
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.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
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 :^)
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
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.
2022-09-05WebServer: Make bound socket a clickable hyperlink :^)networkException
This patch adds a hyperlink that can be hovered over and clicked on to open the WebServer's index page in Browser.
2022-08-02LibHTTP+WebServer: Add querystring support0xbigshaq
Split the path from querystring when determining the requested resource.
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
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.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
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.
2022-04-16LibCore+Everywhere: Make Core::Stream read_until() return BytesSam Atkins
This affects BufferedSeekable::read_until() and ::read_until_any_of(). For the reasoning, see the previous commit about Core::Stream::read().
2022-04-09WebServer: Add utf-8 charset to Content-Type header for text/plainLady Gegga
2022-03-19WebServer: Add Content-Length header to HTTP responsesMaciej
This makes the browser know how much data it should expect.
2022-02-18WebServer: Close the socket if Connection: keep-alive isn't requestedAli Mohammad Pur
2022-01-27WebServer: Unveil /etc/timezone for readingAndreas Kling
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
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. :^)
2022-01-14WebServer: Add charset declaration to directory listingsMaciej
2022-01-13LibCore+Userland+Tests: Convert Stream APIs to construct on heapsin-ack
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.
2022-01-03WebServer: Make ErrorOr unwrapping more idiomaticMaciej
This still not propagates errors properly, but is at least (more) consistent with the codebase.
2021-12-27LibCore+Services: Make TCPServer propagate errorsSam Atkins
2021-12-16LibCore+Userland: Convert TCPServer to use the Serenity Stream APIsin-ack
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.
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-23WebServer: Port to LibMain :^)Andreas Kling
2021-11-23LibCore+AK: Move MappedFile from AK to LibCoreAndreas Kling
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
2021-09-02Userland: Migrate to argument-less deferred_invokesin-ack
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.
2021-08-24WebServer: Add 'Content-Type' header for error responsesMarco Cutecchia
Previously when the WebServer sent an error page the browser would show the raw HTML since we forgot to send the 'Content-Type' header
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-06-11WebServer: Add support for HTTP basic authenticationMax Wipfli
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. :^)
2021-06-11WebServer: Move server configuration into WebServer::ConfigurationMax Wipfli
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.
2021-06-11WebServer: Use canonical reasons phrases for error responsesMax Wipfli
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.
2021-06-11WebServer: Sort entries in directory listingMax Wipfli
2021-06-11WebServer: Append trailing slash for directory linksMax Wipfli
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.
2021-06-11WebServer: Make ".." equal to "." in server root directoryMax Wipfli
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.
2021-06-11WebServer: Refuse to respond to requests for device filesMax Wipfli
Responding with some device files such as /dev/random never terminates, so let's just refuse that.
2021-06-11WebServer: Use outln() instead of printf()Max Wipfli
2021-06-11WebServer: Defer invocation of Client::remove_from_parent()Max Wipfli
This is necessary to avoid trying to destruct the on_ready_to_read function from inside the function. This fixes #7810.
2021-06-11WebServer: Use east const style in Client.{cpp,h}Max Wipfli
This also removes two unused headers.
2021-06-01AK+Everywhere: Replace usages of URLParser::urlencode() and urldecode()Max Wipfli
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.
2021-05-30WebServer: Put dbgln's behind WEBSERVER_DEBUGEdwin Hoksberg
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/.
2021-05-30WebServer: Exit when the given port is invalidLinus Groh
Similar to an invalid listen address, we should not fallback to the default port (8000) but instead exit with an error.
2021-05-30WebServer: Replace printf()/fprintf(stderr) with outln()/warnln()Linus Groh
2021-05-30WebServer: Add optional listen address argumentEdwin Hoksberg
With this we can make the Webserver listen on another address than the default of "0.0.0.0".
2021-05-18WebServer: Fix jailbreaking of server via .. relative pathsDexesTTP
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 :^)
2021-05-17WebServer: Set no-cache header for responsesGunnar Beutner
This sets the Pragma: no-cache header. Using Cache-Control would be preferable but that's not part of the HTTP/1.0 standard.
2021-05-17WebServer: Don't read until EOFGunnar Beutner
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.
2021-05-16AK+Userland: Remove nullability feature for the ByteBuffer typeGunnar Beutner
Nobody seems to use this particular feature, in fact there were some bugs which were uncovered by removing operator bool.
2021-05-13Userland: Tighten a *lot* of pledges! :^)Andreas Kling
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!
2021-05-12LibCore+Everywhere: Move OpenMode out of IODeviceAli Mohammad Pur
...and make it an enum class so people don't omit "OpenMode".