With JDK9, I can see the following request & response pair:
request
Sec-WebSocket-Key: 30OwU9P2rjT/qWL3QC0kmw==
Sec-WebSocket-Version: 13
response
101 HTTP_1_1
cf-ray: 3bd0f4b01edd7880-LAX
connection: upgrade
date: Mon, 13 Nov 2017 10:13:00 GMT
sec-websocket-accept: BKivHQBCLbWp/Wt+a/adShOiReo=
sec-websocket-version: 13
server: cloudflare-nginx
set-cookie: __cfduid=d67ffb74a74787b4a8d115b303c9932b11510567979; expires=Tue, 13-Nov-18 10:12:59 GMT; path=/; domain=.bitfinex.com; HttpOnly
upgrade: websocket
websocket-server: uWebSockets
My problems is that I got WebSocketHandshakeException with message
Response field 'Sec-WebSocket-Version' present: [13].
I do not understand why at the point, the client side require the header 'Sec-WebSocket-Version' should not present. If the server sends it, why the client can not just ignore it, but throw handshake exception? Anyone knows why this exception happened? Thanks.
Related
I need help or any suggestion. I have no idea how to do it?
Request URL: https://www.vizofly.com/NTU/Stress/StreamingAssets/Schools.json
Request Method: GET
Status Code: 200 (from disk cache)
Remote Address: 172.66.43.59:443
Referrer Policy: strict-origin-when-cross-origin
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
cf-cache-status: DYNAMIC
cf-ray: 6d4c32aacdb1926d-FRA
content-encoding: br
content-type: application/json
date: Fri, 28 Jan 2022 18:14:00 GMT
etag: W/"1261-61f2caaf-3e2d8e;;;"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
last-modified: Thu, 27 Jan 2022 16:39:11 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v3?s=aVZAHndifoZtrY0MH3O1WlauF71saxbdUuS7eBS0tReoUi5fGDG3zSlxFCTvbIwJxvGeVeiQyjT%2FVIUWKfUpxNbRT1jUi%2F9VEOvJnaBBRtJKapsW8RBKeLUxqP%2FusLzYEHQ%3D"}],"group":"cf-nel","max_age":604800}
server: cloudflare
x-content-type-options: nosniff
x-frame-options: ALLOW-FROM https://www.ntu.edu.sg
If you're asking about how to configure JMeter to send the request:
Add Thread Group to your Test plan
Add HTTP Request sampler and set it up like:
You may also want to add HTTP Cache Manager to represent browser cache, HTTP Cookie Manager to automatically handle cookies and so on in order to configure JMeter to behave more like a real browser
Having a problem with Varnish 3.x probe page from a SpringBoot application (1.4). Varnish is failing to detect the probe page (returns 503 SERVICE NOT AVAILABLE) and consequently fails to route.
When I manually ping the probe URL, it works fine, but Varnish is flagging the probe page as being down.
Removing the probe page, everything works fine.
Pointing to a static probe page (my.css) or any other static or dynamic URL fails.
Looking at the logs, the response header looks like this:
HTTP/1.1 200
Content-Type: text/plain;charset=utf-8
Content-Length: 72
Date: Wed, 01 Feb 2017 15:20:48 GMT
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Comparing this to other working (non Spring Boot) applications, the only difference is that the working applications have an OK after the response, and the bad ones don't:
HTTP/1.1 200 OK
Does that mean anything?
For example, here is a good one:
HTTP/1.1 200 OK
Date: Wed, 01 Feb 2017 14:04:18 GMT
Last-Modified: Fri, 11 Nov 2016 22:00:02 GMT
Content-Type: text/css
Content-Length: 129
Server: Jetty(9.3.z-SNAPSHOT)
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Is this a SpringBoot issue? Not sure where else to look!
Any clues?
Varnish support has replied
You found the issue: https://github.com/varnishcache/varnish-cache/issues/2069
This is "fixed" in master. But maybe you can fix your backend?
Now to see how to change Spring Boot response message!
I have been trying to get a rather simple JMeter test up and running with cookies for days and having no luck at all. I have exhausted almost all SO threads with attempts to fix this, but no luck yet.
My test is simply to POST login username/password to a server, which returns a SAML token if successful. Then I resubmit that SAML token to my replying party site, which successfully responds with cookies in the headers.
However, every subsequent request does NOT pass along these cookies.
Here is the layout of my plan:
Thread Group
HTTP Request Default
HTTP Cookie Manager
HTTP Request - GET load login page
HTTP Request - POST user/pass to remote server and store SAML token
HTTP Request - POST Submit SAML token to Relying Party site (successfully returns cookies in response)
HTTP Request - GET View protected page (always send [no cookies])
Debug Sampler
View Results Tree
Aggregate Report
I Have enabled these settings:
CookieManager.allow_variable_cookies=true
CookieManager.save.cookies=true
CookieManager.check.cookies=false
The result of the 3rd HTTP Request Sampler responds with a HTTP Response like this:
Thread Name: Visitors 1-1
Sample Start: 2015-09-29 11:53:49 AEST
Load time: 1949
Connect Time: 400
Latency: 1369
Size in bytes: 83261
Headers size in bytes: 2013
Body size in bytes: 81248
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: text/html; charset=utf-8
Expires: -1
Pragma: no-cache
Content-Length: 81248
Date: Tue, 29 Sep 2015 01:53:52 GMT
Connection: keep-alive
Set-Cookie: sitecore_device=; path=/
Set-Cookie: .ASPXAUTH=CC27DB52E62EA5412220CB33ECD9BB84F4A65B76C5A46F8A5A2271AC862C8ED4C71F06258060F30EEB162EF43863B5EDBCDAE0D07002AA71D64F5A473D6FF197E2598F1ACAACB6E36D64D5B9E3B59C102851FF9B22844079BCA09326D491FE5F763E5C7A03FE89AA000600E452B5EAAA64AB83ED5D870B18F86DD213A524FB2F2DF76FECDCB302DEB51BBF39F9FAE6308111E5E084009F1DD8A82E700D8C8DD04E7015DAFFEB5F7373210019F72DF323C3CF2D02; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=1yguqfbt5eyrvgo1agawui0z; path=/; HttpOnly
Set-Cookie: sitecore_device=; path=/
Set-Cookie: .ASPXAUTH=CC27DB52E62EA5412220CB33ECD9BB84F4A65B76C5A46F8A5A2271AC862C8ED4C71F06258060F30EEB162EF43863B5EDBCDAE0D07002AA71D64F5A473D6FF197E2598F1ACAACB6E36D64D5B9E3B59C102851FF9B22844079BCA09326D491FE5F763E5C7A03FE89AA000600E452B5EAAA64AB83ED5D870B18F86DD213A524FB2F2DF76FECDCB302DEB51BBF39F9FAE6308111E5E084009F1DD8A82E700D8C8DD04E7015DAFFEB5F7373210019F72DF323C3CF2D02; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=1yguqfbt5eyrvgo1agawui0z; path=/; HttpOnly
Set-Cookie: rvconf=0; path=/; HttpOnly
Set-Cookie: rvre=14432509917526119; path=/; HttpOnly
HTTPSampleResult fields:
ContentType: text/html; charset=utf-8
DataEncoding: utf-8
I also realise that some cookies are being set twice from the server, but this is out of my control. I hope that this is not the issue...
Pass the cookie variable in jMeter (you can access your ASP.NET_SessionId in this manner ${COOKIE_ASP.NET_SessionId}) to pass the cookie values to the HTTP Header Manager associated with the request.
JMeter Cookie Manager
I am not using the SBT, but making direct REST calls with Abdera to the current version of Connections on IBM SmartCloud. REST URL in question: https://apps.na.collabserv.com/search/serviceconfigs
Observations
When testing from my laptop (using Firefox and the REST client add-on,) this works as expected. I get back an ATOM feed.
When testing from a server (on a different network,) using the same method (Firefox + REST client,) I get back HTML that is a log-in page.
In addition, I get this same result when I call the URL from a Java program on the same server.
In all cases, I am using the same credentials with basic authentication.
Update: If I log into SmartCloud first, on a separate tab in Firefox on the server, then call the URL as before, from another tab, it works. I get the ATOM feed as desired. Naturally, this is unsuitable as a solution, but I present it as additional information that could lead to an actual solution.
Update: Further testing shows that the local (laptop) log-in exhibits the same behavior as the server. A form-based log-in is required from the same browser, then subsequent REST calls work.
Update: Here is a relevant simplified code snippet:
private static Abdera ABDERA = new Abdera();
private static AbderaClient ABDERA_CLIENT = new AbderaClient(ABDERA);
...
String host = "https://apps.na.collabserv.com";
ABDERA_CLIENT.addCredentials(host, AuthScope.ANY_REALM, "basic", new UsernamePasswordCredentials("user", "password"));
...
ClientResponse response = ABDERA_CLIENT.get("https://apps.na.collabserv.com/search/serviceconfigs");
Summary
It appears that something about the originating server or the call is causing SmartCloud to respond with a log-in page. Whereas, the same call and credentials from my laptop, work as expected.
Question
Where should I start to trouble-shoot this? How can I build the client credentials to allow programmatic log-in?
Response Headers
If it helps, here are the response headers that I get back in each case.
Unsuccessful
Status Code: 200 OK
Cache-Control: no-cache
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 1850
Content-Type: text/html
Date: Tue, 08 Oct 2013 14:15:03 GMT
Pragma: no-cache
Server: WebSEAL/6.1.1.3 (Build 110428)
Set-Cookie: PD-H-SESSION-ID=4_0_IR4***masked***oRKlJI;secure; Path=/; HttpOnly BIGipServerE3A-WebSEAL-80-fe=2132806922.20480.0000;secure; path=/
Vary: Accept-Encoding
p3p: CP="NON CUR OTPi OUR NOR UNI"
Successful
Status Code: 200 OK
Cache-Control: public, max-age=86400, s-maxage=86400, no-cache=set-cookie, private, must-revalidate
Content-Encoding: gzip
Content-Language: en-US
Content-Length: 1164
Content-Type: application/atom+xml; charset=UTF-8
Date: Mon, 07 Oct 2013 17:21:12 GMT
Expires: Tue, 08 Oct 2013 17:21:12 GMT
Server: WebSphere Application Server/8.0
Vary: Accept-Encoding
p3p: CP="NON CUR OTPi OUR NOR UNI"
x-lconn-auth: true
x-powered-by: Servlet/3.0
#Grant is your login using SAML? I could see this redirect happening. also could be TFIM related... maybe you should grab the auth on a different page, store the cookies, and then try connecting to the endpoint above.
WebClient.DownloadStringAsync does cache the server response.
After once getting a response from the server I get a response even without internet connection!
Is WebClient caching smart enough to determine from the server response how long to cache?
Or is it buggy and I should disable caching.
Backgound info:
Url: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
Fiddler trace:
GET /stats/eurofxref/eurofxref-daily.xml HTTP/1.1
Accept: /
Referer: file:///Applications/Install/4D0DF1F7-1481-45CA-86BE-C14FF5CCD955/Install/
Accept-Encoding: identity
User-Agent: NativeHost
Host: www.ecb.europa.eu
Connection: Keep-Alive
HTTP/1.1 200 OK
Date: Sun, 25 Mar 2012 08:54:40 GMT
Server: Apache/2.2.3 (Linux/SUSE)
Last-Modified: Fri, 23 Mar 2012 13:31:39 GMT
ETag: "19d4e5-6a9-4bbe90b5904c0"
Accept-Ranges: bytes
Content-Length: 1705
Keep-Alive: timeout=3, max=200
Connection: Keep-Alive
Content-Type: text/xml
Set-Cookie: BIGipServerPOOL.www.ecb.europa.eu_HTTP=2684883628.16415.0000; path=/
...
Disabling caching via Headers does not work:
.Headers("cache-control") = "no-cache"
.Headers("HttpRequestHeader.IfModifiedSince") = DateTime.UtcNow.ToString()
Disabling caching via appending uniqa parameter works:
"http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" & "?MakeRequestUnique=" & Environment.TickCount
The integrated cache isn't smart at all. So if you expect different results when querying the page, you have to bypass it. I say 'bypass' because there's no way I know of to disable it with the WebClient (I don't think it's enabled if you directly use the HttpRequest class).
So if you want to use the WebClient, the best way is to append a random parameter to the request.