Comments (23)
Correct, no other changes needed. It's mainly for user convenience really. Everyone's got their own way of importing external projects, just figured I'd point out one option using FetchContent
.
from liblifthttp.
Awesome! I'll port my stuff to your library, let it run its tests and see how that works out and let you know. Thanks again!
from liblifthttp.
Hey, thanks for reaching out. This feels like a good time to publish a new v3 version + tag. There have been quite a few cleanup/api refinements to try and make it more consistent moving forward as well as making the regression tests more robust. I've got a few more cmake changes I'd like to roll into this but then I can publish v3, would tomorrow work for you?
from liblifthttp.
Of course, no rush, good work by the way! Speaking of cmake, I'd propose that if you are using cmake ≥ 3.11, you can use the following to add your project at the configuration time instead of build time, which would allow some IDE (such as QT Creator) to properly find the headers and functions for syntax checking:
cmake_minimum_required(VERSION 3.11)
# stuff
include(FetchContent)
FetchContent_Declare(
lifthttp
GIT_REPOSITORY https://github.com/jbaldwin/liblifthttp.git
GIT_TAG v2.0
)
FetchContent_MakeAvailable(lifthttp)
# other stuff
target_link_libraries(${PROJECT_NAME} PRIVATE lifthttp)
This is where the release matters (in my case at least) because it will pull whatever version you are specifying (mainly for reproducible builds).
from liblifthttp.
Would this need to be declared for each tag version? I'm not familiar with how FetchContent works but it looks really cool.
Edit:
I think I understand now, this is how you are including it in your project, so you would declare the tag/version you wanted for a reproducible build, very similar to how git submodules work.
from liblifthttp.
Exactly like git submodules (this explains it properly), you don't have to include a git tag, in which case it will fetch master
. It's slightly better if you do put a release tag so you don't encounter api breaking issues by always pulling the latest master
.
from liblifthttp.
I don't mind setting the required verison to 3.11 in the lift cmakelists.txt, 2.8 is quite ancient, but unless if I'm misunderstanding this I don't think any other change are required for lift?
from liblifthttp.
Ubuntu 18.04 appears to only have cmake 3.10 so I'll see if we can build 3.11 from source in the regression pipeline.
from liblifthttp.
Not very surprised that Ubuntu has such an old version of cmake. 3.11 was released March 2018... Arch FTW.
Edit: Maybe don't modify your CMakeLists.txt
but mention the option in the README.md
file?
from liblifthttp.
https://github.com/jbaldwin/liblifthttp/pull/67/files
How about this for the readme? Seems like a good alternative, compiling cmake is too expensive for a regression run and I'd rather not bake it into a docker container if I can avoid it.
from liblifthttp.
Yep that's perfect!
from liblifthttp.
https://github.com/jbaldwin/liblifthttp/releases/tag/v3.0
Give it a whirl when you get a chance and let me know if you run into any issues.
from liblifthttp.
Will do, I'll give an update tomorrow! Thanks!
from liblifthttp.
Only issue I'm seeing right now is:
std::cout << "HTTP Status Code: " << lift::to_string(response.StatusCode()) << "\n";
gives:
error: cannot initialize a parameter of type 'lift::LiftStatus' with an rvalue of type 'http::StatusCode'
LiftStatus.hpp:49:16: note: passing argument to parameter 'status' here
from liblifthttp.
What compiler and version are you using?
edit: It appears to be using the wrong to_string function, is this in a specific example? I have had all the errors/warnings turned down for a while, maybe I should bump that back up
from liblifthttp.
Yep, directly from the README.md. I'm using clang 9.0.1 and also gcc 9.3.0.
from liblifthttp.
let me try the readmes again manually, I copied them directly from the examples/ directory but maybe they are out of date again, whoops
from liblifthttp.
ok yep, totes broken, I'm going to add a readme.cpp example which is literally the readme code so its always compiling, i'll make a 3.1 for you in a minute
from liblifthttp.
lol thanks!
from liblifthttp.
https://github.com/jbaldwin/liblifthttp/releases/tag/v3.1
Should be good in the README now, there is also an examples/readme.cpp that is identical code.
from liblifthttp.
Works great! Only issue I encountered is my code would check the status code from curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code)
which is actually a long
according to https://github.com/curl/curl/blob/master/include/curl/curl.h, so it's easy to compute if it's a 200 or 404 for example, instead of doing a string compare against "200 OK". I'm going to do some benchmarking to see if there's a noticeable loss in performance or if its negligible. Thanks again!
Edit: Feel free to close this issue. I'll open up a new one if needed.
from liblifthttp.
Maybe the following would be better? This will do a direct integer compare like the CURLINFO_RESPONSE_CODE but with a c++ enum class for static typing. Hope that helps.
if(response.StatusCode() == lift::http::StatusCode::HTTP_200_OK) { ... do something .. }
from liblifthttp.
Yeah that works great actually, thanks!
from liblifthttp.
Related Issues (20)
- Switch to std style naming, e.g. everything snake_case?
- Adjust clang-format styling to custom settings
- Adjust atomics to use correct std::memory_order
- Update benchmarks after atomic change
- Add support for CURLOPT_CONNECTTIMEOUT_MS
- Add lgtm integration support
- Auto clang-format on commit and update readme.cpp
- Add callback hook for on event loop thread creation
- Event loop uses std::priority_queue for timeouts instead of std::multimap HOT 1
- Rename lift::event_loop to lift::client
- Streaming CONNECT_ONLY sockets HOT 2
- Use recursive locks for lift::share
- Add std::future on client async request
- C++ 20 coroutines for async requests
- Async requests always segfaults HOT 12
- Switch to semver versioning HOT 1
- Switch to `main` from `master` for default branch. HOT 1
- remove lgtm in readme
- Add CI Matrix for fedora
- lift::client destructor infinite loop HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liblifthttp.