Why is sending HTTP request invalid?


Elam V

I have implemented the code below to send the HTTP request to the server, but for some reason it is not working (no entry on fiddler) Can anyone help? [EDIT] I added error handling to the code

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
...

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
Name: "{commondesktop}\My Program"; Filename: "{app}\MyProg.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\MyProg.exe"; Description: "{cm:LaunchProgram,My Program}"; Flags: nowait postinstall skipifsilent


[code]

procedure CurStepChanged(CurStep: TSetupStep);
var
  WinHttpReq: Variant;
begin
  if CurStep = ssDone then
      begin

      WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
      WinHttpReq.Open('GET', 'http://publishers-x.databssint.com/', false);
      WinHttpReq.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      WinHttpReq.Send('cool');
      // WinHttpReq.ResponseText will hold the server response
          if WinHttpReq.Status <> 200 then
begin
  MsgBox(WinHttpReq.Status, mbError, MB_OK);
end
else
begin
  MsgBox('SUCCESS', mbInformation, MB_OK);
end;


    end;
  end;
Deanna

Any 2xx status code is successful. In your case, 202 means "Accepted" . It's intentionally vague, but the request does reach the server, and it replies.

As for why it's not showing up in Fiddler, Fiddler is at the application level and acts as a proxy instead of a packet monitor. The WinHttpRequestdocumentation implies that it does not use the normal system-configured proxy, but its own configuration or values ​​set at runtime.

If you want to use Fiddler for testing, call SetProxy with Fiddler's details:

WinHttpReq.SetProxy(2, 'localhost:888');

Alternatively, use WireShark to monitor network traffic directly.

Related


Why is sending HTTP request invalid?

Elam V I have implemented the code below to send the HTTP request to the server, but for some reason it is not working (no entry on fiddler) Can anyone help? [EDIT] I added error handling to the code ; Script generated by the Inno Setup Script Wizard. ; SEE TH

When sending okhttp request: HTTP error 405 and invalid_client

king alexander I am making a request to a website. However, I keep getting the JSON returned {"error":"invalid_client"}. Also, when I navigate to the URL, I'm making a request through the web browser, which shows up as HTTP ERROR 405. Based on those errors I'v

When sending okhttp request: HTTP error 405 and invalid_client

king alexander I am making a request to a website. However, I keep getting the JSON returned {"error":"invalid_client"}. Also, when I navigate to the URL, I'm making a request through the web browser, which shows up as HTTP ERROR 405. Based on those errors I'v

Net::HTTP not sending request

Kevin I have the following method in a Ruby 1.8.7 project: def self.ping_server request_data = get_request_data uri = 'another_server.our_company.com' https = Net::HTTP.new(uri) https.use_ssl = true path = "/our_service" data = request_data.to_jso

Why is the request not sending data?

Baek Seung Hyun I just made the server. The server returns raw data. So when I use Restlet Client in Chrome Extension to Server I can return json post data. However, the Python Requests module does not return. I do requestsn't think data is sent. Python 3.6.8

Why is the request not sending data?

Baek Seung Hyun I just made the server. The server returns raw data. So when I use Restlet Client in Chrome Extension to Server I can return json post data. However, the Python Requests module does not return. I do requestsn't think data is sent. Python 3.6.8

Why is the request not sending data?

Baek Seung Hyun I just made the server. The server returns raw data. So when I use Restlet Client in Chrome Extension to Server I can return json post data. However, the Python Requests module does not return. I do requestsn't think data is sent. Python 3.6.8

Invalid HTTP request (JavaScript)

badminton Here is my code : http://codepen.io/anon/pen/MbLEEE xmlhttp.open("GET", "anyURL", true); xmlhttp.send(); I don't know how to complete my HTTP request. When I enter a random URL, I always get the same ResponseCode. What did i do wrong? Vijay You need

$http.post not sending request?

A generation I try to do one $http.postand get a response, I tried several ways but it doesn't work. The data I am sending (userData) is a json object. I'm taking data from a user's Excel content addin application and converting it to json to post the data to

$http.post not sending request?

A generation I try to do one $http.postand get a response, I tried several ways but it doesn't work. The data I am sending (userData) is a json object. I'm taking data from a user's Excel content addin application and converting it to json to post the data to

Sending HTTP request with python - error

Brammat I'm trying to write a Python script to send HTTP requests, so I read the content validation code from the Python documentation on the urllib2 library ( https://docs.python.org/2/howto/urllib2.html#id6 ) , But still getting error... Here is my code (*to

$http.post not sending request?

A generation I try to do one $http.postand get a response, I tried several ways but it doesn't work. The data I am sending (userData) is a json object. I'm taking data from a user's Excel content addin application and converting it to json to post the data to

Invalid JSON primitive when sending POST request

Welcome to the Internet I have the following ajax request and am trying to send a JSON object to the server: function sendData(subscriptionJson) { $.ajax({ type: "POST", url: '@Url.Action("SubscribeSe

Invalid JSON primitive when sending POST request

Welcome to the Internet I have the following ajax request and am trying to send a JSON object to the server: function sendData(subscriptionJson) { $.ajax({ type: "POST", url: '@Url.Action("SubscribeSe

Invalid header error when sending request with curl

Highest this is my code echo 22; $url = 'http://www.10bet.com/pagemethods.aspx/GetLeaguesContent'; $fields = array( 'BranchID' => urlencode('1') , 'LeaguesCollection' => urlencode('10098') , ); $fields_string = ''; fore

Invalid header error when sending request with curl

maximum this is my code echo 22; $url = 'http://www.10bet.com/pagemethods.aspx/GetLeaguesContent'; $fields = array( 'BranchID' => urlencode('1') , 'LeaguesCollection' => urlencode('10098') , ); $fields_string = ''; fore

Invalid JSON when sending request to server

or smith I wrote a server and I want to check it by sending a POST request as a client. var local = "./0"; var querystring = require('querystring'); var http = require('http'); var fs = require('fs'); function PostCode(u, file, s) { // Build the post stri

Invalid JSON when sending request to server

or smith I wrote a server and I want to check it by sending a POST request as a client. var local = "./0"; var querystring = require('querystring'); var http = require('http'); var fs = require('fs'); function PostCode(u, file, s) { // Build the post stri

Invalid JSON primitive when sending POST request

Welcome to the Internet I have the following ajax request and am trying to send a JSON object to the server: function sendData(subscriptionJson) { $.ajax({ type: "POST", url: '@Url.Action("SubscribeSe

Invalid header error when sending request with curl

maximum this is my code echo 22; $url = 'http://www.10bet.com/pagemethods.aspx/GetLeaguesContent'; $fields = array( 'BranchID' => urlencode('1') , 'LeaguesCollection' => urlencode('10098') , ); $fields_string = ''; fore

Invalid JSON when sending request to server

or smith I wrote a server and I want to check it by sending a POST request as a client. var local = "./0"; var querystring = require('querystring'); var http = require('http'); var fs = require('fs'); function PostCode(u, file, s) { // Build the post stri