summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibHTTP
AgeCommit message (Collapse)Author
2023-04-02LibHTTP: Tolerate extra \r\n in chunked-encoding last block sizeAli Mohammad Pur
Some servers put CR/LF there, so let's tolerate that behaviour. Fixes #18151.
2023-03-26LibHTTP: Return error if request is incompleteAliaksandr Kalenik
If there is not enough input to completely parse HTTP request we need to return error and handle it in HTTP server.
2023-03-26LibHTTP+WebDriver+WebServer: Return error from HTTP request parserAliaksandr Kalenik
2023-03-13AK: Rename Stream::write_entire_buffer to Stream::write_until_depletedTim Schumacher
No functional changes.
2023-03-13AK: Rename Stream::{read,write} to Stream::{read_some,write_some}Tim Schumacher
Similar to POSIX read, the basic read and write functions of AK::Stream do not have a lower limit of how much data they read or write (apart from "none at all"). Rename the functions to "read some [data]" and "write some [data]" (with "data" being omitted, since everything here is reading and writing data) to make them sufficiently distinct from the functions that ensure to use the entire buffer (which should be the go-to function for most usages). No functional changes, just a lot of new FIXMEs.
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-03-09AK: Remove infallible version of StringBuilder::to_byte_bufferLinus Groh
Also drop the try_ prefix from the fallible function, as it is no longer needed to distinguish the two.
2023-03-09LibHTTP: Propagate OOM errors from HttpRequest::to_raw_request()Linus Groh
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullOwnPtrVectorAndreas Kling
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-02-13Everywhere: Remove the `AK::` qualifier from Stream usagesTim Schumacher
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Move Stream-based sockets into the `Core` namespaceTim Schumacher
2023-02-08AK: Remove the fallible constructor from `FixedMemoryStream`Tim Schumacher
2023-01-29AK: Move memory streams from `LibCore`Tim Schumacher
2023-01-29AK: Move `Stream` and `SeekableStream` from `LibCore`Tim Schumacher
`Stream` will be qualified as `AK::Stream` until we remove the `Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is defined by `SeekableStream`, since defining its own would require us to qualify it with `AK::SeekMode` everywhere.
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2023-01-21AK: Remove `FileStream`Tim Schumacher
2023-01-03LibCompress: Rename `Compress::Zlib` to `Compress::ZlibDecompressor`Tim Schumacher
Because that's what it is, even if it mainly relies on `DeflateDecompressor` to do the heavy lifting.
2023-01-02Everywhere: Move AK/Debug.h include to using files or removeBen Wiederhake
2023-01-02LibHTTP: Propagate errors using TRYericLemanissier
2022-12-20AK: Stop using `DeprecatedString` in Base64 encodingJelle Raaijmakers
2022-12-15LibCore: Rename `MemoryStream` to `FixedMemoryStream`Tim Schumacher
This is to differentiate between the upcoming `AllocatingMemoryStream`, which automatically allocates memory as needed instead of operating on a static memory area.
2022-12-12LibHTTP: Don't read and drop data if status line can't be readTim Schumacher
The idea of reading some amount of data presumably was to check if the stream is still operable. However, this permanently breaks the request format, as those 64 bytes are just lost forever. Instead, just let the request fail instantly for now and think about making it retry some time in the future. Since `can_read_line` updates the read buffer beforehand, this should only happen in the rarest of cases anyways.
2022-12-12LibCompress: Port `DeflateDecompressor` to `Core::Stream`Tim Schumacher
2022-12-12LibCore: Propagate errors from `Stream::*_entire_buffer`Tim Schumacher
2022-12-12LibCore: Rename `Stream::*_or_error` to `*_entire_buffer`Tim Schumacher
All of our functions are `_or_error` (or are about to be), and maybe making it less reminiscient of AK::Stream will make people use it more.
2022-12-12LibCore: Rename `Stream::read_all` to `read_until_eof`Tim Schumacher
This generally seems like a better name, especially if we somehow also need a better name for "read the entire buffer, but not the entire file" somewhere down the line.
2022-12-10LibCompress: Port GzipDecompressor to `Core::Stream`Tim Schumacher
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-30LibCore: Add support for ReadonlyBytes to MemoryStreamTim Schumacher
2022-11-07LibHTTP: Always send Content-Length header in POST requestsLuke Wilde
Required by Google services, Content-Length should always been sent, even when there is no body.
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-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-10-18LibHTTP: Fix not consuming the last byte of body in from_raw_requestLuke Wilde
`index + 1` was not correct. For example, if the body has two bytes, we would consume the first byte and increment the index. We then add one to the index and see it's equal to the size, so we take this one byte and set the body result to it. The while loop would still continue and we consume the second byte, adding it to the temporary buffer. We see that the index is above the size, so we don't update the body, dropping the last byte on the floor.
2022-10-11LibHTTP: Include request body in HttpRequest::from_raw_request()Sam Atkins
2022-10-11LibHTTP: Make HTTP method names more accessibleSam Atkins
Previously you could only get the name of an HttpRequest::Method if you already had an HttpRequest.
2022-10-01LibHTTP: Use 'close' as the default value for Connection in HTTP/1.0Idan Horowitz
Unlike HTTP/1.1 and above, the default behaviour for HTTP/1.0 servers is to close the connection after sending the response.
2022-09-26LibHTTP: Null out on_ready_to_read on socket closeEnver Balalic
This fixes the segfault reported in #15283. on_ready_to_read gets re-registered on every job start anyways. I see no reason why this could be bad.
2022-08-02LibHTTP+WebServer: Add querystring support0xbigshaq
Split the path from querystring when determining the requested resource.
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-07-04LibHTTP: Include JsonObject.h in Job.cppDaniel Bertalan
JsonArray.h does not #include the definition of JsonValue::serialize, as it lives in JsonObject.h. The macOS Clang target handles symbol visibility slightly differently (I couldn't figure out how exactly), so no visible instantiation ended up being created for the function, causing a link failure.
2022-06-27LibHTTP+RequestServer: Recognize more HTTP methodsLuke Wilde
Previously it would default to GET for all of these and cause the Discord API to return Method Not Allowed errors for certain endpoints.
2022-05-21LibHTTP+LibWeb: Accept Brotli encoded responsesMichiel Visser
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-16LibCore+Everywhere: Make Core::Stream::read() return BytesSam Atkins
A mistake I've repeatedly made is along these lines: ```c++ auto nread = TRY(source_file->read(buffer)); TRY(destination_file->write(buffer)); ``` It's a little clunky to have to create a Bytes or StringView from the buffer's data pointer and the nread, and easy to forget and just use the buffer. So, this patch changes the read() function to return a Bytes of the data that were just read. The other read_foo() methods will be modified in the same way in subsequent commits. Fixes #13687
2022-04-10LibHTTP: Don't re-urlencode URL query stringsAndreas Kling
AK::URL stores the URL query string already encoded. We were sending double-encoded query strings, which is why the Google cookie consent page was not working correctly.
2022-04-08AK+LibHTTP: Revert prior change to percent encode plus signsGeekFiftyFive
A change was made prior to percent encode plus signs in order to fix an issue with the Google cookie consent page. Unforunately, this was treating a symptom of a problem and not the root cause and is incorrect behavior.
2022-04-02AK+LibHTTP: Ensure plus signs are percent encoded in query stringGeekFiftyFive
Adds a new optional parameter 'reserved_chars' to AK::URL::percent_encode. This new optional parameter allows the caller to specify custom characters to be percent encoded. This is then used to percent encode plus signs by HttpRequest::to_raw_request.