Getting HTTP xml error response using cURL - c++

I am currently using cURL to communicate to a cloud site... everything is going well except for an annoying issue. The issue is that I cannot get the site's xml response when there is an error. for example, when I use Wire Shark to check the transfer I can see that in the HTTP header that I'm getting which contains the error code; there is an XML data that contains in addition to the error code, a message that describes the code. I have tried many cURL options to try and get the XML but all my attempts failed.
Could someone tell me how can I get the XML. please note that I'm using the cURL C APIs as my code is in c++ and moreover, I can get XML responses when the operation succeeds using my write callback function.

Set CURLOPT_FAILONERROR to 0. If this is set to 1, then any HTTP response >= 300 will result in an error rather than processing like you want.

Related

how to do xsl:include over https in saxon?

I'm trying to run a transform directly from github. Saxon opens the initial xsl, but barfs on included xsls:
transform -xsl:https://raw.githubusercontent.com/VladimirAlexiev/LODE/master/src/main/webapp/extraction.xsl -s:ebg-ontology.rdf -o:index.html
Error on line 35 column 43 of extraction.xsl:
XTSE0165: I/O error reported by XML parser processing
https://raw.githubusercontent.com/VladimirAlexiev/LODE/master/src/main/webapp/swrl-module.xsl:
unknown protocol: https
Question Saxon error with XSLT import statement is slightly related but it uses java whereas I run from the command line. #michael-kay suggests there to add a base URL: I've added xml:base="." to no avail (and as you can see from the error message, the url of the module is correct).
What should I to do to enable Saxon to handle https? Running SaxonHE9-7-0-21N-setup.exe

Azure EventHub ConnectionStringBuilder not returning the correct connection string

I am trying to get started with Eventhubs using the following link https://azure.microsoft.com/en-us/documentation/articles/event-hubs-java-storm-getstarted/.
When I pass the connection string directly to the ConnectionStringBuilder( connectionString), then the program sends data to the Eventhub. I notice that the connection string
starts with Endpoint=sb://....
but when I use ConnectionStringBuilder(namespaceName, eventHubName, sasKeyName, sasKey), I notice that the connectionstring created
starts with Endpoint=amqps://
and the program doesn't work and gives the following error
com.microsoft.azure.servicebus.AuthorizationFailedException: Attempted to perform an unauthorized operation.
I missed the last char of the SaSKey and so It didn't work...Sorry for this question

Weird character in chrome when sending URL

I'm having some trouble while trying to open a local file in google-chrome as it gives me a weird URL in google chrome but prints just fine in the console.
Here is my code:
int subId = 902 ;
system(("google-chrome "+localURL+"initialFr.html?id="+to_string(subId)).data());
std::cout << ("google-chrome "+localURL+"initialFr.html?id="+to_string(subId)).data() << std::endl
Here is the output I get in the console:
file:///home/lonni/Questionnaire/initialFr.html?id=902
Here is the address I get in chrome:
file:///home/lonni/Questionnaire/initialFr.html%3Fid=902
I am using c++11 (hence the .data()) on ubuntu.
Would you guys know where this comes from?
Thanks in advance
The file: URL schema does not support HTTP schema parameter passing. Those parameters are intended to be interpreted by an HTTP server.
If you need to pass a parameter, you can use an anchor, for example:
file:///home/lonni/Questionnaire/initialFr.html#902

Google Native Client Visual Studio Add-in: Webserver fails to start because arguments to httpd.py are invalid

I have an application that I turned into a simple Native Client App a year ago, and I've been trying to get it running again. However, when I try to run it, or any of the example VS projects, the web server fails to start, giving me usage hints for httpd.py, and saying "httpd.py: error: unrecognized arguments: 5103".
I wasn't able to find anything about this on the NaCL guide or on the net. I could probably troubleshoot the issue if I could see the script that starts the webserver, but I have no idea where this is stored.
The script that start the server is 'nacl_sdk\pepper_43\tools\httpd.py'. The problem is with the port argument being formated incorrectly.
The expected format is:
httpd.py [-h] [-C SERVE_DIR] [-p PORT] [--no-dir-check]
But, the received arguments formatted by the add-in is:
['--no_dir_check', '5103']
where the port prefix is missing and should be '-p 5103'
For a quick fix, add the following line
parser.add_argument('args', nargs=argparse.REMAINDER)
before the parse_args(args) in the main(args) method in httpd.py.
This will keep the unknown arguments from being parsed and will use the default value for port instead (5103).

what is the deal with Facebook API error: Could not parse into a date or time

Im getting group wall posts , just fine in the end of the json response , im getting the paging object
when i take the previous value and try to http request it:
https://graph.facebook.com/175923872448029/feed?access_token=**********13c0fd29b9-557002013|N-oGZ6q2sNDNg1I3leS0v9U-TDw&limit=25&since=2011-01-25T1100253A3400253A2100252B0000
im getting this error :
{
"error": {
"type": "InvalidArgumentException",
"message": "Could not parse '2011-01-25T1100253A3400253A2100252B0000' into a date or time."
}
}
what is wrong with the date ?
when you open https://graph.facebook.com/175923872448029/feed in your browser you'll notice that the paging link consists of utf numeric codes which have to be decoded prior to using them [edit].
However, when I requested the same object using the PHP SDK I got an encoded URL which works fine.
The reason for that behaviour is explained, I believe, in this post.
In summary, you have to check what the returned string looks like and decode it adequately before you proceed.