-
Notifications
You must be signed in to change notification settings - Fork 11
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
It adds a method at TRestTools to do http POST requests #172
Conversation
@lobis there is no |
Perhaps the problem is elsewhere or I have to install some dev dependency @jgalan ? Also I propose to replace the docker image to |
Did you have a look to the pipeline error? It does not find |
This is the correct output, its printing the help menu for |
How can I Installed this? |
Maybe curl is installed, but not the development libraries. Headers are not found.
|
Perhaps https://stackoverflow.com/questions/11471690/curl-h-no-such-file-or-directory |
I think it is |
…can be externally updated
Perhaps we could use ROOT built in libraries to perform this request and thus avoid having to link this library to the framework, as not everybody will have it installed. (as we saw its not on Ubuntu 20.04 by default). https://root-forum.cern.ch/t/http-get-request/16891/3 ROOT can download files via http so I am sure this is possible. If this is not the case or its too hard, perhaps we could add this header to the external dependencies via cmake? Also why don't we use http |
Yes, I looked to that root forum thread previously and I tried the
Yes, likely, and we have our own method
I added it to the
I dont know, this was suggested by @Vindaar I am just following. Of course, we could have another method Plz, will you add curl-dev to the docker? :) |
It is added #172 (comment). It isn't working? |
I this case we should use whatever is easier I think. The already existing method uses |
…work into jgalan_tools_post
I added this PR #173 which adds |
My solution is simply reverse engineered by looking at the network communication the browser does when using the tool. Initially I tried a |
Why not calling curl from |
While this doesn't add a dependency to REST, it makes the whole functionality more brittle. Makes the code more platform dependent, but more importantly we now have an implicit dependency. While curl is extremely ubiquitous, I don't think it's a good idea to depend on it being installed. |
I don't quite understand. Isn't that the current implementation including curl header also dependent on curl being installed? |
No, Strange, no? This didnt happen on Gentoo where you compile everything :) |
@Vindaar How it would look like the |
Sorry, what are you asking? |
Actually, what would be the full |
Ahh, I see. The POST request: curl -d "Layer=Au&Ldensity=-1&Thick=250.0&Sigma1=0.0&Substrate=SiO2&Sdensity=-1&Sigma2=0.0&Pol=0&Scan=Energy&Min=7495.0&Max=15000.0&Npts=499&temp=Angle+%28deg%29&Fixed=0.95&Plot=LinLog&Output=Plot" \
-X POST "https://henke.lbl.gov/cgi-bin/laymir.pl" That returns the HTML. Use your favorite way to extract the HREF from the resulting HTML (if done on the command line Then just GET: curl "https://henke.lbl.gov/cgi-bin/<extracted_link>" |
Ok, everyone happy with the |
As I alluded to above, I don't think relying on an installed binary is a good idea. Rather deal with the dependency once at compilation stage of REST and be certain that a compiled REST is able to fetch the files than pray that the dependency is there at runtime and deal with the fallout of that. But feel free to go with it. |
Right, I also prefer to deal with the installation of the library if needed at compilation time, for me just a It is also true that some time ago I tried to compile GDL the GNU version of IDL, and I gave up because I had to disable 100 dependencies. It is true that a 100 dependencies is not good. |
I am personally against any |
Ok, so thats the new commit I added, it does not use a |
I also don't like system calls but I think it's better than relying on adding new user requirements. In my opinion the best would be to use the CPR library installed via cmake fetch content, but there are some bugs I couldn't fix. |
Why not use something like cpp-httplib? |
…es with connection
I need the updates at this PR at master, the new methods added are operative and documented, could you please approve and create an issue about upgrading From my point of view we will survive till the previous issue is solved. |
I was suggesting https://github.com/libcpr/cpr but https://github.com/yhirose/cpp-httplib seems also fine. |
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.
TODO: remove libcurl
requirement for the user
Probably this TODO is lost if not in an issue |
TRestTools::POSTRequest
to do POST requests to a website.TRestTools::ReadASCIITable
added an optional argument to skip header lines.TRestMetadata::GetSearchPath
now adds alsoREST_USER_PATH
as a default.TRestTools::ExportASCIITable
method added to write a file with the contents ofstd::vector<std::vector>>
.@rest-for-physics/core_dev