autobench on HTTPS endpoint - ssl

How do I set in autobench that I'm testing an HTTPS (port 443) URL?
When I call it with:
autobench --single_host --host1 host.com --port1 443 --uri1 /hello --num_conn 1000 --timeout 5 --low_rate 10 --high_rate 50 --rate_step 10 --num_call 10 --quiet --file results.tsv
it shows:
httperf.parse_status_line: invalid status line `<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'!!
httperf.parse_status_line: bad status 1
Which is not correct because that HTTPS page (in the example above would be https://host.com/hello) returns a valid 200 OK response.
Thanks

You need to add the following line to your ~/.autobench.conf file:
httperf_ssl = NULL
--ssl is a command-line argument of httperf, which autobench calls underneath. The NULL value means to not pass a value for that arg to httperf.
Generally speaking, you can add any additional command-line arguments to httperf by putting them in the config file and prepending them with httperf_. Another example:
httperf_add-header = "Authorization: Basic Zm9vOmJhcg=="
is equivalent to running httperf --add-header "Authorization: Basic Zm9vOmJhcg=="

Related

How to query SFTP server with Karate via API?

The app that I am trying to test has an SFTP server that can be queried via API. Swagger shows the following sample cURL request to get domain files information, and I am having a hard time making this call with Karate:
curl -X GET -H 'Accept: application/json' 'https://{host}:{port}/api/{clientId}/'
I do the following where baseUrl is defined as https://sftp.mydomain.com:22 where 22 is the port number that I can successfully use to connect to the SFTP server via Cyberduck:
Feature:
Background:
* url baseUrl
* def moduleBase = '/api/12345/'
Scenario:
* path moduleBase
When method get
Then status 200
The error that I get is this:
ERROR com.intuit.karate - src/test/java/mytest.feature:9
When method get
http call failed after 815 milliseconds for url: https://sftp.mydomain.com:22/api/12345/
What am I doing wrong?
Clearly it may not be HTTP so I don't think Swagger and all is legit.
Maybe you can just delegate to the OS. Refer: https://stackoverflow.com/a/64352676/143475

How to call some api url with some header in it using the bat file?

Following is the bat file code for executing the URL from a bat file. I wanted to send the header with the URL. How can I send the header with it?
#ECHO OFF
SET BROWSER=firefox.exe
SET WAIT_TIME = 2
START %BROWSER% -new-tab
"http://localhost/warmup/api/Event/eventsLoc/17.4575262/78.373212/1221"
#ping 127.0.0.1 -n %WAIT_TIME% -W 1000 > nul
pause
please help.
I would advise you to use cURL instead of Firefox.
It is designed for command line so :
you can run it silently (without opening a window)
there are much more options for the command line, such as specifying the HTTP call method (GET, POST, PUT...) and as you required the header.
example from the doc
curl --header "Destination: http://nowhere" http://example.com

monitoring plugin check_http cert expiration check

[root#chi plugins]# '/usr/lib64/nagios/plugins/check_http' '-C' '15,30' '-I' '99.830.700.184' '-S' '-p' '443'
SSL OK - Certificate 'localhost' will expire on 2018-12-14 02:20 +0000/UTC. HTTP WARNING: HTTP/1.1 404 Not Found - 226 bytes in 0.156 second response time |time=0.155850s;;;0.000000 size=226B;;;0
I need to suppress The HTTP 404 warning. If there's another plugin that can do this, I'd like to know about it. (I can't change anything on the webserver.)
You can use the same plugin, but add -e 404, so it will look like:
[root#chi plugins]# '/usr/lib64/nagios/plugins/check_http' '-C' '15,30' '-I' '99.830.700.184' '-S' '-p' '443' '-e' '404'
The -e 404 flag suppress 404 error code.
I used the tcp command (check_tcp plugin) instead. I should have been using check_tcp all along.
In my /etc/icinga2/zones.d/global-templates/global-commands.conf file I added
apply Service "HTTPS/8443: Secure Management Interface" {
import "generic-service"
check_command = "tcp"
vars.tcp_port = "8443"
vars.tcp_ssl = true
vars.tcp_timeout = 60
vars.tcp_ipv4 = true
vars.tcp_ipv6 = false
vars.tcp_timeout = 30
assign where host.vars.devtype == "dadada"

apache benchmark: fails with lengthy custom header for authorization

Apache benchmark is failing when using lengthy custom authorization header -
ab.exe -n 1 -c 1 -S -H "Authorization: SAML PHRyaWJ1dGUgQXR0cmlidXRlTmFtZT0iaGFzX3NlbGVjdCIgQXR0cmlidXRlTmFtZXNwYWNlPSJodHRwOi8vc2NoZW1hcy5iZW50bGV5LmNvbS93cy8yMDExLzAzL2lkZW50aXR5L2NsYWltcyI+PHNhbWw6QXR0cmlidXRlVmFsdWU+dHJ1ZTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBd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RHQmR4MktZdzBuUHJSM0F1YkRQVTZJNjlhWTBFNGJIRUM2Y09nOGxjeUhkWXFyZDNSRlByUjJiN1hGWVdyaXRXeElXbHFNRUVzNVU3dkRsYjkrby9HRlZqbE1QSW4xcG0yNDBUYW41WkR0Si9NcXZZRTYrQzh1ZUtEZW1lcndiR0ZCNzFJTVI3TUU1SHYzayt3N0hFMm1ETjF0RnVjb1ZyQVVFZndYVUNzTUdzMkJJbzJsVVNGL3FIYUY3akhHdnJPUmloVFlKQnBtQzRpWmJRTGpLQmZBRXBTVT08L1g1MDlDZXJ0aWZpY2F0ZT48L1g1MDlEYXRhPjwvS2V5SW5mbz48L2RzOlNpZ25hdHVyZT48L3NhbWw6QXNzZXJ0aW9uPg==" -v 2 http://localhost:55495/rest/1
Please note that I am testing .net rest api which needs lengthy user token in authorization header to proceed.
Apache Benchmark has a maximum request size of 2048 characters. Your header alone is more than 4KB in size, so that's why your test is failing. The maximum size of the request is given in ab.c. Look for char _request[2048]; in that file and try increasing it. Note that the passed-in headers are also parsed into a header structure that may have limits as well.
You can install the ab from httpd source code, which now sets char _request[8192];.
The code can be found in httpd-2.4.53/support/ab.c

Github API 502 error

I'm trying to add a user to a Github repository via their API, but I always get a 502 Bad Gateway error.
With curl I send a request like this (<...> replaced by a real owner, repo, etc.):
curl -i -H 'Authorization: token xxxxxxxxxx' -XPUT https://api.github.com/repos/<owner>/<repo>/collaborators/<username>
I also tried it with this url:
curl -i -H 'Authorization: token xxxxxxxxxx' -XPUT https://api.github.com/teams/<id>/members/<username>
As token I used a newly created Personal Access Tokens
But both times I get this back
HTTP/1.0 502 Bad Gateway
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>
A GET on each URL works fine but a DELETE doesn't work either. So maybe it has to do with curl.
Quoting the reply from GitHub's support with changes in italic:
You're just getting trolled by HTTP and curl.
When you make a PUT request with no body, curl doesn't explicitly set a Content-Length header for that request. However, PUT requests with no Content-Length confuse servers and they respond in weird ways.
Can you please try explicitly setting the Content-Lenght header to 0, or supplying an empty body when making that request (so that curl can set the header for you)? You can accomplish that adding -d "" in your command.