Skip to content
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

Core dump #32

Closed
pschuegr opened this issue Dec 22, 2012 · 5 comments
Closed

Core dump #32

pschuegr opened this issue Dec 22, 2012 · 5 comments

Comments

@pschuegr
Copy link
Contributor

I'm getting a core dump with a really simple request using ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]. I'm sure this is not a typhoeus (edit: sorry, I meant Ethon) problem, but you may have some ideas? It started as soon as I added the httppost.

$: << './lib'
require 'ethon'

e = Ethon::Easy.new
e.http_request(
  'http://<bucket-name>.s3.amazonaws.com',
  :post,
  { 
    :body => 'hi there',
    :httppost => 'multipart/form-data',
    :params => {

    } 
  } 
)
e.perform
puts e.response_body
@hanshasselberg
Copy link
Member

Hi @pschuegr,

sorry for the late response!
You're seeing this error because your are assigning the wrong thing to http_post, its supposed to be a pointer. See here for usage examples: https://github.com/typhoeus/ethon/blob/master/spec/ethon/easy/http/post_spec.rb. It is actually not easy to do it manually.
I suggest using the helper method http_request:

easy = Ethon::Easy.new
easy.http_request("www.example.com", :post, { params: { a: 1 }, body: { b: 2 } })
easy.perform

Also you are mentioning typhoeus - which is a related project but not the same: https://github.com/typhoeus/typhoeus.

@pschuegr
Copy link
Contributor Author

Thanks @i0rek. I found the example in the spec and everything is working fine. I don't think it should be core dumping, though, or is that part of the way it binds to libcurl?

@hanshasselberg
Copy link
Member

@pschuegr actually it is possible to catch that here: https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/options.rb#L284. Do you want to take a stab at it?

@pschuegr
Copy link
Contributor Author

Sure, I can have a go. Should I just catch a general exception, or is there a more specific one?

@hanshasselberg
Copy link
Member

You could validate the input and raise an ArgumentError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants