Extracting StatusCode from TWebBrowser OnNavigateError in Delphi 10.3 - delphi

I'm trying to get the HTTP response code in an OnNavigateError event of a TWebBrowser. The StatusCode passed to me is always -2146697211 when it should be 404. What am I missing? I'm using Delphi 10.3.

TWebBrowser uses Microsoft's Internet Explorer, so information about the NavigateError event can be found online.
The explanation of the StatusCode parameter links to "NavigateError Event Status Codes" - there you see your typical 3-digit HTTP status codes, but also additional ones. Your decimal value of -2146697211 is $800C0005 in hexadecimal - both match the INET_E_RESOURCE_NOT_FOUND constant, which again links to another page:
It means "The server or proxy was not found."
Why is this a separate error code and not a HTTP one? Because it happens before HTTP is performed: looking up the IP address to a hostname has failed - nobody knows which IP address the hostname you tried to browse to has. That's what the Domain Name System (DNS) is for. Not being able to get in contact with a server is a different thing than being able and getting a response. HTTP 404 is a reponse. But since you don't even got a response, hence you cannot get a HTTP status code.
Long story short: host not found (instead of "HTTP 404" = host found, but not the page you're looking for). Try it with an address/a hostname that can be actually resolved.

Related

Prevent Edge browser hiding HTTP error pages

Microsoft's Edge browser has a "friendly error page" feature similar to Internet Explorer's, where it masks a server's non-success responses (e.g. 400 Bad Request) with its own "friendly" pages.
You can observe the behaviour by using Edge to visit here: http://httpstat.us/400
Whilst this is a better user-experience than being presented with highly technical default server error pages, it's an unwanted experience when you want to return an actual page with a non-success status code.
In Internet Explorer, as long as the server returned more than 512 bytes of data in the response, it would display the response, but in Edge, that's not enough.
Is there a way to coerce Edge to display the "error" content returned by the server when a non-success status code is returned? I don't want to reconfigure the browser, just convince it that my response is "friendly" enough to present to the user.
There is no way to remove the "friendly errors" at the moment. You can use the F12 developer tools for debugging.
Nevertheless, the friendly page includes the actual HTTP response code so you can have an idea. Also, if you require more details you can check the full details on the request/response using the F12 Network tool to get the data the server is responding with.
In Internet Explorer, as long as the server returned more than 512 bytes of data in the response, it would display the response, but in Edge, that's not enough.
In experimenting, I found that this is indeed enough (example here of working 400 page).
I also though found that if you had previously sent a response of 512 characters or less, and then fixed the response to be greater, refreshing the page or following a link to it would still get the "friendly" (with friends like these, who needs enemies?…) message. Entering the URI in the address bar again (i.e. just focusing in the address-bar and hitting enter) was necessary to make the error page actually appear.

status code 500 internal server error in LoadRunner

I have a web application which i need to be load tested using LoadRunner. When I record the website using vugen it works good and there is no any application bug. But when I tried to replay the script, script failed after login and while navigating to next page, say, Transaction. At the end of log, I receive error:
Action.c(252): Error -26612: HTTP Status-Code=500 (Internal Server Error)
for "http://rob.com/common/transaction
Please help me to resolve this error.
LoadRunner generates HTTP request just as your browser does, this error is the same error you would get if you would go to that URL using your browser. Error code 500 is a generic server error that is returned when there is no better (more specific error to return).
Most likely the login process requires some form of authentication which is protected against a replay attack by using some form of token. It is up to you to capture this token using Correlations in LoadRunner and replay it as the server expects. The Correlation Studio in VuGen should detect and identify the token for you but since authentication methods vary it is sometimes impossible to do this automatically and you will have to create manual correlation. Please consult the product documentation for more details on how to do it. If your website is publicly available online then post its URL and I will try to record the script on my machine.
Thanks,
Boris.
Most common reasons
You are not checking each request for a valid result being returned and using a 200 HTTP status as an assumed correct step without examining the content of what is being returned. As a result when data being returned is incorrect you are not branching the code to handle the exception. Go one to two steps beyond where your business process has come off the rails with an assumptive success and you will have a 500 status message for an out of context action occurring 100% of the time.
Missed dynamic element. Record three times. Compare the code. Address the changing components.

Facing issue while trying to check the Incoming request in Fiddler

I am trying to check the incomming request to my server. Another server which has hosted MVC application. An action method is sending some data to my server. I am using Fiddler. But somehow it is not showing the incoming request.
Below mentioned are my settings in Fiddler Custom Rules..
static function OnBeforeRequest(oSession: Session) {
if (oSession.host.toLowerCase() == "IP Address:8888")
oSession.host = "IP Address:82";
}
Below mentioned are my Fiddler Options.
Am I missing anything ?
It sounds like you're trying to use Fiddler as a reverse proxy. You should read the steps at http://www.fiddler2.com/r/?reverseproxy. The biggest thing to understand is that when running as a reverse proxy, you only see traffic in Fiddler if the client's URL is changed to point at Fiddler.
If it is ssl connection then you need to enable option 'capture https connection' from 'https' tab. Did you try to invoke request from other browser like chrome ? Does fiddler capture anything?
You don't need custom rule for this case. It should work if you enable these settings. I have faced only some problems in other browsers like FF.
I'm not sure I can answer your question fully without knowing a few additional pieces of information.
If the request being made is not a HTTP request, Fiddler will not be able to handle it.
Also, if you're using the loopback address localhost then Fiddler may not be able to find it.

Google Search Appliance error - ProcessNode: Does not contain a valid host, skipping record with url

I am using Google Search Appliance in my application for search functionality. The data to be searched are pushed into the GSA by POSTing the data as XML into the GSA.
After POSTing the data from a windows service, i am getting a success message. But when i check the feed section in the GSA console i am seeing this error against the XML that is pushed. Any idea what this is?
Thanks in advance.
Does the host of the affected element contain a protocol in front of the url and ends with a slash if its the root url of a domain? Or is the host without a toplevel domain?
http://server.tld -> valid
http://server -> invalid
The server url without domain is sadly not possible in the GSA, even if thats standard in intranet sites. In this case you have to use the server url including the network domain.
It is at least not a xml structure error but one with an invalid url submitted. You can try to add the affected url into the Start Patterns of the GSA to test if the same error is occurring.

Jmeter OAuth Plugin

I am using jmeter to perform some load testing. this particular test will record how long it takes to get a response from a web service using OAUTH.
I have added the Jmeter Oauth plugin, set up my keys, url and data to be posted etc, however I keep getting an error message within my report
Response code: Non HTTP response code: java.net.URISyntaxException
Response message: Non HTTP response message: Expected closing bracket for IPv6 address at index 14
Has anyone had this error before or does anyone have a good guide on how to use the OAUTH plugin?
Any help appreciated
when i get this error the problem was that i perfix the server name or ip
with http
so if you set server name or ip parameter with for example http://www.google.com you need
to replace it with www.google.co.il namely omit the http://
(you can set the protocol http in the protocol value of http request)

Resources