-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibRequests+LibWeb+RequestServer: Propagate HTTP reason phrase #1876
Conversation
2371877
to
8fba95b
Compare
Marking this ready for review -- I don't see a good way of adding in-tree tests for this without something like an echo server proposed in #1801 |
8fba95b
to
843aba5
Compare
Hello! One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the |
fb80fec
to
c43dc9a
Compare
7b5c90c
to
8e9ab9e
Compare
@@ -27,7 +27,7 @@ target_link_libraries(RequestServer PRIVATE requestserverservice) | |||
|
|||
target_include_directories(requestserverservice PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/Services/) | |||
target_include_directories(requestserverservice PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) | |||
target_link_libraries(requestserverservice PUBLIC LibCore LibMain LibCrypto LibFileSystem LibIPC LibMain LibTLS LibWebView LibWebSocket LibURL LibThreading CURL::libcurl) | |||
target_link_libraries(requestserverservice PUBLIC LibCore LibMain LibCrypto LibFileSystem LibIPC LibMain LibTLS LibWeb LibWebView LibWebSocket LibURL LibThreading CURL::libcurl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LibWeb LibWebView
Not exactly your fault but...why does RS need to link against anything libweb?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really goes way back: 58e3b8c (though it makes sense in a weird way)
Also cc @trflynn89...that seems like a hack at best? why not depend directly on generate_RequestClientEndpoint.h
and generate_RequestServerEndpoint.h
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have a really hacky way to get IPC-generated files into the ladybird build, back when we had to deal with both lagom and serenity sources:
ladybird/Meta/Lagom/CMakeLists.txt
Lines 425 to 441 in 58e3b8c
if (ENABLE_LAGOM_LIBWEB) | |
list(APPEND lagom_standard_libraries Web) | |
# WebView | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/AccessibilityTreeModel.cpp") | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/DOMTreeModel.cpp") | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/StylePropertiesModel.cpp") | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/ViewImplementation.cpp") | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/WebContentClient.cpp") | |
list(APPEND LIBWEBVIEW_SOURCES "../../Userland/Libraries/LibWebView/RequestServerAdapter.cpp") | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentServer.ipc WebContent/WebContentServerEndpoint.h) | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebContentClient.ipc WebContent/WebContentClientEndpoint.h) | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverClient.ipc WebContent/WebDriverClientEndpoint.h) | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/WebContent/WebDriverServer.ipc WebContent/WebDriverServerEndpoint.h) | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestClient.ipc RequestServer/RequestClientEndpoint.h) | |
compile_ipc(${SERENITY_PROJECT_ROOT}/Userland/Services/RequestServer/RequestServer.ipc RequestServer/RequestServerEndpoint.h) |
Don't know if we're still doing this, but I can't imagine there's a reason we need to continue that hack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still doing that (roughly, those are listed in the GENERATED_SOURCES for WebView), but even then there's no real reason to actually link that thing in afaict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the gn build we generate the header in the client library build script. I would prefer that here in CMake as well.
auto const reason_phrase_string_view = header_line.substring_view(second_space_offset + 1).trim_whitespace(); | ||
|
||
if (!reason_phrase_string_view.is_empty()) { | ||
request->reason_phrase = Web::Infra::isomorphic_decode(reason_phrase_string_view.bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to link against libweb just to get a stringbuilder + append_code_point in a loop?
Also cc @trflynn89 (iirc you merged that), maybe we could put that function in the header or just inline here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also be moved to LibTextCodec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR was previously linking against LibTextCodec and just using a Latin1 decoder directly. Should I just revert to using that again?
8e9ab9e
to
e89e084
Compare
Alright, let's get this in the tree, we can fix the dependency problem later. |
Fixes 54 test cases across the following WPT tests :^)