Code Monkey home page Code Monkey logo

rb-libcurl's People

Contributors

charonn0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rb-libcurl's Issues

cannot GET data from one specific URL

Hi,

libcURL works like a charm, but only on one specific URL, we run into a #22 HTTP error.

Our method:

Var curl As New cURLClient
curl.EasyItem.TimeOut = 3

var ascURL as string = "https://graphhopper.com/api/1/"

Var theResult As String
If Not curl.Get(ascURL) Then
  via.Log.toConsole("CURL ERROR  Position 2: #" + curl.LastError.ToString + " -> https://curl.se/libcurl/c/libcurl-errors.html")
  via.Log.toConsole("URL: " + ascURL)
  
Else
  theResult = curl.GetDownloadedData
  VIA.Log.toConsole("result received: " + theResult.Length.ToString + "chars long")
  VIA.Log.toConsole("http call: successfull")
  
  Return theResult
End If

We always end in the error-section with a #22 cURL error (curl.LastError.ToString).
The page it self is reachable, also when we use cURL on the commandline. Also other calls over the same method (with different URLs) are working as expected.

What is the issue here? What do we miss?

Thanks!!!

ResponseHeaderEngine raises a FunctionNotFoundException on older versions of libcurl if the request didn't generate any headers

The curl_easy_nextheader function is very new, so if you're not using the bleeding edge latest release of libcurl then it won't be available. The ResponseHeaderEngine knows this, and falls back on the old behavior if the new API isn't available. However, if the request fails without generating any headers then the ResponseHeaderEngine will be fooled into thinking the new API is available. When the API is actually called upon a FunctionNotFoundException is raised.

CookieEngine can't be turned off

Setting CookieEngine.Enabled to False after previously setting it to True does not turn off cookies. There doesn't appear to be any obvious way to turn it off; even calling Reset on the EasyHandle doesn't do it.

Headers are not deleted when have a blank value, even though they should

So according to Daniel Stenberg, the way to remove a header is to pass a blank value with the name of the header as you can see here: http://stackoverflow.com/a/26250768

I followed his steps with:

Dim h as new InternetHeaders
h.AppendHeader("X-Requested-With","")
c.SetRequestHeaders(h)

SetRequestHeaders formats it the way it should be ("X-Requested-With:"), but the header doesn't get deleted. Instead it is added multiple times.
I "remove" a header each time I add one, so not sure why it does not work.

Screenshot from Fiddler: http://i.imgur.com/f6OkS0O.png

Let me know if you need a sample project.

EasyHandle.LastError overwritten by debugger

The debugger reads computed properties when examining an EasyHandle via Introspection, some of which call into libcURL. This overwrites LastError (often with zero). Store the last error somewhere safe before breaking into the debugger.

cURLItem leaks socket descriptors

Currently, cURLItem detects when a socket is about to be closed in the CloseCallback method. However, libcURL expects us to actually close the socket from this callback, and we aren't. Thus, the socket enters a Close_Wait state and does not destruct.

How to get result from a POST call

Hi,

we started to use your classes, which work very well.

However we have now the case, that we need to get the response after a POST call. How can that be done?
The .GetDownloadedData method returns nothing.

Thanks.

cURLManager.Constructor(cURLManager) shouldn't need to know whether the EasyHandle is a subclass

In order for a custom subclass of EasyHandle to be copied correctly, the proper subclass constructor must be called from cURLManager.Constructor(cURLManager). Currently, the subclass is detected using IsA, which is a kludge and doesn't allow anonymous subclasses of EasyHandle to work as expected.

Either cURLManager.Constructor(cURLManager) needs to change, or EasyHandle.Constructor must never be overridden by a subclass.

PUT returns bad/illegal format or missing URL on ARM 64-bit

Expected behavior

PUT should run with no errors.

Actual behavior

Code run per the example given to PUT ftp file returns "URL using bad/illegal format or missing URL" when build architecture set to ARM 64-bit

Steps to reproduce the behavior

Run the demo app with the latest version with build architecture set to X86 64-bit. PUT a file to a server. File transfer is successful.
Close the demo app, change the architecture to ARM 64-bit. PUT the same file to a server and response is "CURLE_URL_MALFORMAT(3): URL using bad/illegal format or missing URL"

DEFAULT_CA_INFO_PEM does not exist

@charonn0

Expected behavior

Var curl As New cURLClient

Var result As String = ""
Var img As FolderItem = SpecialFolder.CurrentWorkingDirectory.Child("temp.png")
curl.RequestHeaders.SetHeader("X-Api-Key", App.ap1key)
Var data As Dictionary 
data.Value("image") = data
If curl.Post(App.ap1_url, data) = True Then
  result = curl.GetDownloadedData
End If

TextField3.Text = result

Writing the result in Textfield3

Actual behavior

Throwing two errors while compiling:

This item does not exist
bs.write(DEFAULT_CA_INFO_PEM)

Parameter "value" expects type String, but this is type Int32.
bs.write(DEFAULT_CA_INFO_PEM)

Steps to reproduce the behavior

  1. Smoke a cigarette
  2. Copy and paste code from the top of this issue message to your own project
  3. Try to compile
  4. Despair
  5. Drink vodka or similar strong alcohol
  6. Post issue here on GitHub

Doesn't find libcurl.dll

Expected behavior

Finding liburl.dll

Actual behavior

It still complains it doesnt find it tried different versions of the dll

Steps to reproduce the behavior

just open in debug of a build version.

If i need more or a specific version could you provide direct links to them ?

cURLManager should be able to handle multiple simultaneous transfers

Currently, both the simplified cURLClient class and its superclass cURLManager can perform exactly one transfer at a time. This is not a limitation of libcURL. The cURLManager class should permit an arbitrary number of transfers; only the cURLClient class should not since it's meant to be simple to use.

PUT to SMB generates 0 byte files

Expected behavior

The file is transferred to the SMB server

Actual behavior

A zero byte file is created on the SMB server

Steps to reproduce the behavior

While I encounter the problem in my project, I also can't get a PUT working in the cURL.rbvcp sample project. The below steps are using the sample project.

If I enter the path as smb://192.168.1.10/delete-me/file.pdf and then in the Raw Options enter my username and password, then PUT a pdf file (using either 'Put' or 'Put Threaded') nothing much seems to happen. I do end up with a zero byte file in the SMB share with the name file.pdf but no data is transferred.

The Xojo debug messages says "Text: Connected to 192.168.1.10 (192.168.1.10) port 445 (#0)"

If I use curl -T file.pdf -u username:password smb://192.168.1.10/delete-me/ then this does transfer the file correctly, so the SMB should be working.

In my application I do get more error messages from libcurl in the debug console - it gives me a "Text: Send failure: Broken pipe" and I also get a zero byte file on the SMB server.

I have tried this on both OSX (libcurl 7.79.1) and on Windows 11 (libcurl 7.83.1) and neither work with SMB.

If using a WebDAV destination rather than SMB everything works as expected.

Any ideas?

SSLInit event is not raised

This event is raised by the SSLInitCallback method when libcURL is about to create a secure socket. However registering for the callback breaks everything so it's being left alone. See also issue #1

SSL/TLS doesn't work

SSL connects, but libcURL complains about the certificate (even if it's valid) and aborts.

--data-urlencode methods not available?

Hi, I saw this changelog message:
dc6f1f1

With this, one should be able to append --data-urlencode properties. But we can't find it in the class, was it removed after?

This is the call we try to perform:

curl -X "POST" "[URL]" \
     -H 'accept: application/json' \
     -H 'Content-Type: application/x-www-form-urlencoded' \
     --data-urlencode "UserName=[USERNAME]" \
     --data-urlencode "Password=[PASSWORD]"

This is our code:

Var theResult As String

Var curl As New cURLClient
curl.EasyItem.TimeOut = timeout

If Not ssl_verifypeer Then
Var sslCertification As Boolean = curl.EasyItem.SetOption(libcURL.Opts.SSL_VERIFYPEER, False)
End If

Call curl.SetRequestMethod("POST")
curl.EasyItem.UseErrorBuffer = True
curl.SetUploadData(requestcontent) 'set the JSON data as a string or memoryblock
curl.RequestHeaders.SetHeader("Content-Type", requesttype) 'set the data type

curl.EasyItem.FollowRedirects = True

If app.useProxy Then
curl.Proxy.Address = app.proxyConfig.Lookup("domain", "").StringValue //"proxy10.domain.loc"
curl.Proxy.Port = app.proxyConfig.Lookup("port", 8080).IntegerValue //8080
curl.Proxy.Type = libcURL.ProxyType.HTTP
End If

Try
If Not curl.Perform(URL, Nil, Nil) Then
  //error
  Var s As String = libcURL.FormatError(curl.LastError)
  // logging here
Else
  //success
  theResult = curl.GetDownloadedData
End If

Catch err As libcURL.cURLException
  // logging here

End Try

FollowRedirects at POST

Our Post request doesn't follow a redirect.

This is our code:

Call curl.SetRequestMethod("POST") 'set the request method
curl.SetUploadData(requestcontent) 'set the JSON data as a string or memoryblock
curl.RequestHeaders.SetHeader("Content-Type", requesttype) 'set the data type

curl.EasyItem.FollowRedirects = True // !!!!! doesn't work?!


Try
  //cURL Call ausführen und ergebnis ermitteln
  If Not curl.Perform(URL, Nil, Nil) Then
    //error
    Var s As String = libcURL.FormatError(curl.LastError)
    via.log.toConsole("Curl POST Method Error 1: " + libcURL.FormatError(curl.LastError), True)
  Else
    //success
    theResult = curl.GetDownloadedData
  End If
  
Catch err As libcURL.cURLException
  via.log.toConsole("Curl POST Method Error 2: " + libcURL.FormatError(curl.LastError), True)
End Try


//Jobid setzen, wie in dem classic aufruf
Var httpstatus As Integer = curl.GetStatusCode

If httpstatus = 200 OR httpstatus = 201 Then 
  //message received 
  via.log.toConsole("Curl POST Method success: " + URL)
  Return theResult
Else
  //error
  // this error is returned
  // 
  via.log.toConsole("Curl POST Method Error 3: " + libcURL.FormatError(curl.LastError), True)
  
  Return ""
End If

image

cURLMulti performs transfers on the main thread regardless of the calling thread

The current implementation calls curl_multi_perform in the Action event of a timer, i.e. on the event loop/main thread. This means that the callback functions will run on the main thread too.

cURLMulti should expose a Perform method which executes curl_multi_perform once on the calling thread, allowing the caller poll libcurl instead of a timer.

CurlItem.CreateSocket event is not raised

This event is raised by the OpenCallback method when libcURL is about to create a socket. However registering for the callback breaks everything so it's being left alone.

64-bit not supported

This project has not yet undergone any sort of testing for 64-bit compatibility.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.