strange reference to SignalR [duplicate] - asp.net-mvc-4

This question already has answers here:
VS2013 RTM making once per second Signal R requests when I check with fiddler
(3 answers)
Closed 9 years ago.
I have an MVC application that I have ported to VS2013 but upon running on my dev machine I have noticed some reference to signalR when I run firebug I don't understand where this come from and why as it seems to be running ever once and then curl 'http://localhost:62899/4645d6c484b844ff9c09255bb97b07b9/arterySignalR/poll?transport=longPolling&connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAAEumWjTMoPkeDOEXv%2BNHRZwAAAAACAAAAAAAQZgAAAAEAACAAAAAh1zpnQcDukz3xmKv6jQ93UejVonzulIb0nfXibU9ozQAAAAAOgAAAAAIAACAAAAC6gz3v487BO50fZx3iXZJKte1SUarM0qPDk9VGtOGWijAAAAD5qwoiK90hXkikTGAOg9nUJzcVRw2x%2BrXg738opqFikHKt4251b6NxJvuH%2F0TKTXhAAAAA51Bi2%2BpR2EmH%2BwbR864v%2Bb0LplFjnpyfFxXvyPrtbB7q7HmbAMmyZbP0HZqGPvxjD%2Fyquhk5vIb4Mjn5VgayGg%3D%3D&messageId=d-45763F85-I%2C0%7CJ%2C4%7CK%2C0&requestUrl=http%3A%2F%2Fmycompany.com%2Fmembership%2Flocation&browserName=Firefox&tid=8&_=1386717058307' -H 'Accept: text/plain, */*; q=0.01' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-gb,en;q=0.5' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Host: localhost:62899' -H 'Origin: http://mycompany.com' -H 'Referer: http://mycompany.com/this/that' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0'
does anyone know why/what is happenning.
Thanks

This is Browser Link.
It's especially useful with Web Essentials.

Related

curl, API request works in Insomnia, but not in generated code for curl

I have request in Insomnia. When I send it via Insomnia, no problemo. But when I generate source code for curl, it shows me this.
curl --request POST \
--url URL \
--header 'Authorization: bearer XXX' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--cookie JSESSIONID=XXX \
--form datasetFile=#FOLDER/producthierarchyl1-1.zip
{"message":"Bad Request","logref":null,"path":null,"_embedded":{"errors":[{"message":"Required argument [Publisher datasetFile] not specified","logref":null,"path":"/datasetFile","_embedded":{},"_links":{}}]},"_links":{"self":{"href":"/data-api/public-api/v4/datasets/ingestion/","templated":false,"profile":null,"deprecation":null,"title":null,"hreflang":null,"type":null,"name":null}}}
Insomnia output is like this.
> POST PATH HTTP/2
> Host: URL
> user-agent: insomnia/2022.3.0
> cookie: JSESSIONID=XXX
> authorization: bearer XXX
> content-type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY
> accept: */*
> content-length: 407
* STATE: DO => DID handle 0x170404b14008; line 2077 (connection #27)
* multi changed, check CONNECT_PEND queue!
* STATE: DID => PERFORMING handle 0x170404b14008; line 2196 (connection #27)
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="datasetFile"; filename="producthierarchyl1-1.zip"
| Content-Type: application/zip
| PK�QU�}�%+producthierarchyl1-1.csvUT բ�b
| --X-INSOMNIA-BOUNDARY--
* We are completely uploaded and fine
* HTTP/2 found, allow multiplexing
Where is the catch?
Thanks.
Remove the --header 'content-type: multipart/form-data; boundary=---011000010111000001101001 option.
It really should not be used like this: curl manages that header and the boundary on its own so changing it should only be done in the rare event you truly want and need to fiddle around with it.
A more minor second thing: --request POST should be dropped from the command line, as it is superfluous and easily cause problems if you add --location later on.
Updated
This flaw is said to have been fixed in a later version of Insomnia
For any folks bumping into this issue again, this answer correctly explains the reason for the problem.
Fortunately this should only be reproducible in versions 2022.3.0 and older versions of Insomnia.
If you use the latest one, 2022.5.1, the generated curl will no longer have this problem, example of a multipart request generated:
curl --request GET \
--url http://mockbin.org/request/anything \
--header 'Content-Type: multipart/form-data' \
--form test=test \
--form test=#/Users/yourUserName/Desktop/somefile.txt

How to create custom user using the REST API?

I am using GraphDB free edition.
I wanted to create a user via REST API and found in the documentation that /rest/security/user/** could be used to create a user.
But what is ** in api endpoint and also how to create a user using the above endpoint? What should be the parameters and body for the POST request?
TIA.
You could create user using GraphDB REST API using following cURL request:
curl 'http://localhost:7201/rest/security/user/username' -H 'Origin:
http://localhost:7201' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'Content-Type: application/json;charset=UTF-8' -H
'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'Referer: http://localhost:7201/user/create' -H 'X-GraphDB-Repository:
repository name' -H 'X-GraphDB-Password: user password' -H 'DNT: 1' --data-binary '{"appSettings":
{"DEFAULT_SAMEAS":true,"DEFAULT_INFERENCE":true,"EXECUTE_COUNT":true,"IGNORE_SHARED_QUERIES":false},"grantedAuthorities":
["ROLE_USER","WRITE_REPO_*","READ_REPO_*"]}' --compressed
You should add -u admin username:password or send for example http://localhost:port number/rest/login POST request with "Content-Type", "application/json; charset=UTF-8", "Accept", "application/json" with JSONObject with registered admin user - username and password and will get header "Authorization" as result token generated for user and you should attach it like: 'Authorization: returned authorization header'.

How to repeat https request with curl?

I have the following data captured:
POST /AppHTTP.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 89
Host: parkingcab.mos.ru
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: App: 4.6() / OS: 7.1.1 / Device: Sony
format=json&appVersion=3&phoneNo=79161234567&PIN=1234&operation=file_list&partnerID=Qulix
HTTP/1.1 200 OK
Date: Sat, 27 Jan 2018 09:57:26 GMT
Server: Apache
Cache-Control: max-age=2592000
Expires: Mon, 26 Feb 2018 09:57:26 GMT
Content-Length: 192
Connection: close
Content-Type: application/json; charset="utf-8"
{"status":1,"operation":"file_list","version":"2.6","response":{"files":[{"file":{"id":"2533922","name":"news.xml","time":"1516885837","type":"text\/xml","partner":"Qulix"}}],"language":"ru"}}
I try to repeat with curl -
curl -vvvv --request POST --header "Content-Type: application/x-www-form-urlencoded" --header "User-Agent: App: 4.6() / OS: 7.1.1 / Device: Sony" --header "Host: pаrkingcаb.mоs.ru" --header "Connection: Keep-Alive" --header "Accept-Encoding: gzip" "https://pаrkingcаb.mоs.ru/AppHTTP.php?format=json&appVersion=3&phoneNo=79161234567&PIN=1234&operation=file_list&partnerID=Qulix"
but I get 503 / No operation response. I also tried to pass data as payload:
curl -vvvv --request POST --header "Content-Type: application/x-www-form-urlencoded" --header "User-Agent: App: 4.6() / OS: 7.1.1 / Device: Sony" --header "Host: pаrkingcаb.mоs.ru" --header "Connection: Keep-Alive" --header "Accept-Encoding: gzip" -d "{'format': 'json', 'appVersion': '3', 'phoneNo': '79161234567', 'PIN': '1234', 'operation': 'file_list', 'partnerID': 'Qulix'}" "https://pаrkingcаb.mоs.ru/AppHTTP.php"
But it didn't help. What am I missing?
You'll like h2c.
If you paste your HTTP request into that, it gives you this curl command line:
curl --header Accept: --compressed --header "Connection: Keep-Alive" --user-agent "App: 4.6() / OS: 7.1.1 / Device: Sony" --data-binary "format=json&appVersion=3&phoneNo=79161234567&PIN=1234&operation=file_list&partnerID=Qulix" https://pаrkingcаb.mоs.ru/AppHTTP.php

The priority of Cache-Control:max-age and ETag

I use AWS S3 bucket the save the image files. I add one metadata max-age=315360000 for each file.
The response headers of image file is as below. In the headers both Cache-Control:max-age=315360000 and etag is set.
Cache-Control:max-age=315360000
Date:Thu, 15 Sep 2016 11:03:31 GMT
ETag:"326ae27d85f6d847f819e19955c0f0aa"
Last-Modified:Tue, 06 Sep 2016 03:23:26 GMT
Server:AmazonS3
x-amz-id-2:O/kt/JoZ/hmxSXUWGvkVLudMs6H4MDk8vgS2hIuZvAgGKMdYJsqSiqx/PnpT5AGsJ6FH8O3MGb4=
x-amz-request-id:9289AFE7D3BACB96
x-amz-version-id:P7bZwWZ9PO4I__ZHzwk5tXeiaU6QLSWJ
Question 1: Which one has the highier priority to control the cache?
If the Cache-Control:max-age=315360000 has higher priotity, the response of the next request should be 200 from cache. If the ETag has higher priotity, the response of the next request should be 304.
I make the test on the Mac chrome (Version 53.0.2785.89 (64-bit)). I get a strange behavior.
Test 1 - access the image url to browser. The response is 304.
Test 2 - access an html file which contains the image element to
reference the image. The response is 200 from cache
I use the chrome dev tool to copy the the two requests as curl command lines.
Test 1 curl command lines
curl 'http://s3.cn-north-1.amazonaws.com.cn/xxxx/xxxx.jpg' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.89 Safari/537.36' -H 'Referer: http://pano.shejijia.com/?locale=zh-CN&data=http%3A%2F%2Fjuran-prod-contents.s3.cn-north-1.amazonaws.com.cn%2FAsset%2Fpanos%2F9b57a2b1-0ff7-4c79-ad3d-3343d95f2ad9%2F2702d299-c269-442f-804b-49d94296454e.json&mode=navipano&designId=9b57a2b1-0ff7-4c79-ad3d-3343d95f2ad9' -H 'Origin: http://pano.shejijia.com' --compressed
Test 2 curl command lines
curl 'http://s3.cn-north-1.amazonaws.com.cn/xxxx/xxxx.jpg' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.89 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'If-None-Match: "d88e24d354fc3b4b43530c0bfe338b01"' -H 'Connection: keep-alive' -H 'If-Modified-Since: Tue, 06 Sep 2016 05:54:16 GMT' --compressed
You can see chrome generates two different curl commands. I guess chrome explains the cache headers in different ways in the two cases.
Questions 2: Why chrome explains the cache headers in different ways in the two cases above?
Questions 3: How to make chrome uses a same manner to response the cache headers? Either one is ok.

curl can't list tenants servers

I'm trying to list some info API style :) and what i have done till now is the following:
Using "curl" i can get the token out, with the token i can list the tenants, but after that i can't list the servers and other information. From the conductore if i execute the "nova --debug list --all-tenants" i get the results and get the commands that are executed with curl. So when im trying this from outside i get an error "404" The resource could not be found.
curl -i 'http://x.x.x.x:8774/v2/tenants/' -X GET -H "X-Auth-Token: <Token_ID>" -H "X-Auth-Project-Id: admin" -H "User-Agent: python-novaclient" -H "Accept: application/json"
And with the following command i don't get errors but i get some strange results:
curl -i 'http://x.x.x.x:8774/v2.0/<Tenant_ID>/servers' -X ET -H "X-Auth-Token: <Token_ID>" -H "X-Auth-Project-Id: <Tenant_ID>" -H "User-Agent: python-novaclient" -H "Accept: application/json"
and the output is:
HTTP/1.1 300 Multiple Choices
Content-Type: application/json
Content-Length: 357 Date: Sun, 03 Apr
2016 21:59:48 GMT Connection: close
{"choices": [{"status": "CURRENT",
"media-types": [{"base":
"application/xml", "type":
"application/vnd.openstack.compute+xml;version=2"},
{"base": "application/json", "type":
"application/vnd.openstack.compute+json;version=2"}],
"id": "v2.0", "links": [{"href":
"http://x.x.x.x:8774/v2/v2.0/<Tenant_ID>/servers",
"rel": "self"}]}]}
So my question is what is wrong here, i get output for tokens and listing tenants but i can't get output for listing servers ??
Thanks in advanced !
I tried to find what is wrong with your curl - made requests to my host, but the answer is in the surface-response, obviously :)
You are trying to connect to nova service with version 2.0, but you have endpoint only with version=2 by default, so version must be 2.
Go to http://x.x.x.x/horizon/project/access_and_security/
and check the "API Access" tab, there are endpoints look to the compute one and use it to connect to service.
For example my compute service have endpoint:
Compute http://controller:8774/v2/004e4c0366b74300b875adfd2c1bca4c
Take them to connect to services by curl.