summaryrefslogtreecommitdiff
path: root/Userland/Services/WebServer
AgeCommit message (Collapse)Author
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".
2021-05-07Services: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
2021-05-03Userland: Fix 64-bit portability issuesGunnar Beutner
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-17Userland: Fix printf specifiers with off_tJean-Baptiste Boric
In theory we should probably use the 'j' qualifier, but we don't support it.
2021-03-06WebServer: Serve X-Frame-Options and X-Content-Type-Options HTTP headersBrendan Coles
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-30WebServer: Stream the downloaded filesAnotherTest
...instead of reading them into memory first. This makes it possible to download large files from WebServer.
2021-01-22Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-12Services: Move to Userland/Services/Andreas Kling