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

Using curlsharp for veracode #4

Closed
devendert opened this issue Nov 5, 2014 · 1 comment
Closed

Using curlsharp for veracode #4

devendert opened this issue Nov 5, 2014 · 1 comment

Comments

@devendert
Copy link

First of all my apologies; This is not an issue.

I am trying to execute veracode api using curlSharp library. Manually I can execute the command as below.
curl --compressed -u [veracodeuser]:[mypassword] https://analysiscenter.veracode.com/api/4.0/getapplist.do -F 'include_user_info=true'

using (var easy = new CurlEasy())
{
easy.UserPwd = "Password"
easy.AutoReferer = true;
easy.FollowLocation = true;
easy.Url = textBoxUrl.Text.Trim();
easy.WriteFunction = OnWriteData;
easy.Perform();
}

I couldn't figure out how to pass username and --compressed -F options. Could you please let me know if I can accomplish this with CurlSharp.

I appreciate your response.

@masroore
Copy link
Owner

@devendert First of all my apologies for late reply.

To enable compressed transfer, use the following code to set the Accept-Encoding: header:

easy.SetOpt(CurlOption.Encoding, "gzip");

Make sure to use a libcurl DLL which was built with ZLIB support. (The DLLs provided with curlsharp should be fine.)

As for authentication, the UserPwd property should be populated with username and password separated by colon:

easy.UserPwd = "username:password";

As for providing HTTP form data, please see the EasyPost sample project. More specifically, refer to the TEST 3 CurlEasy HttpPost section to see how to construct and use HTTP multi-part form data. If you simply need to transmit some raw POST data, you may use the PostFields property (see the TEST 2 CurlEasy PostFields section of the same project) It seems you may not need to the complicated CurlHttpMultiPartForm object for veracode.com...

easy.Post = true;
var postData = "include_user_info=true";
easy.PostFields = postData;
easy.PostFieldSize = postData.Length;
easy.Perform();

Hope this helps.

PS: I couldn't verify the code snippets. Veracode.com is returning some exception at the moment.

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