Visual C++ :: Change HTTP Request Server Response - Proxy?

Nov 19, 2013

Is there anyway to make when browser request some file from server than browser to load another file. Example:

I open [URL] ....

So now the browser send http request to load image [URL] ....

so when browser want to load that image to load this image [URL] ....

I do this now with [URL] ....

I think this can be done with Wininet.dll and WinHTTP.dll

View 3 Replies


ADVERTISEMENT

C++ :: HTTP Response Receive Using Socket

May 18, 2014

I make a simple c++ http post request using socket and it is working fine. But how to get only the message of the response. Here is my receive code:

char buffer[1028];
recv(socket, buffer, sizeof(buffer), 0);
printf("%s", buffer);

Then here is the response that the http send back.

HTTP/1.1 200 OK
Data: Mon, 19 May 2014 12:46:36 GMT
Server: Apache/2.4.9 (Win32) OpenSSL/0.9.8y PHP/5.4.27
X-Powered-By: PHP/5.4.27
Coneten-Length: 28
Content-Type: text/html

All done! Do some stuff now. So what I want to try is get 3 things in this response and put them to string vector but how to do this. What I need is to parse the response and the 200 OK, 28 and All done! Do some stuff now. then put them to string vector.

expected result

response[0] = 200 OK;
response[1] = 28
response[2] = All done! Do some stuff now

View 2 Replies View Related

C :: Unable To Send Binary Data Via HTTP Response

Feb 7, 2013

I'm trying to send some binary data, such as an animated gif, via an HTTP response for a simple web server.

I am having issues having the browser close the connection after receipt of the data.

I create the header such as:

"HTTP/1.1 200 OK
Content-Length: <file size>
Content-Type: <file type>
<binary data>"

This is stored in a malloc'ed char *. To add the binary data I'm using fread: fread(request + strlen(request), 1, size, fp)

I then write 'total' bits via connfd:

write(connfd, request, total)
where total = strlen(headerRequest) + size + 3 (for ending
).

The writing seems to be okay however the image doesn't load and the browser still seems to be waiting for data.

If I added "Connection: close" to the header and closed connfd myself the page loads fine. Obviously, for efficiency purposes, I'd rather only close connfd once read() returns 0.

The header creation code is below:

======= Code:

/* Try to get file */
strcat(cwd, file);
if(endsWith (cwd, ".html") || endsWith(cwd, ".htm")) {
strcpy(fileType, "text/html");
binary = 0;
} else if (endsWith(cwd, ".txt")) {
strcpy(fileType, "text/plain");
binary = 0;

[Code]...

View 7 Replies View Related

C++ :: HTTP POST Request - Connection Failure

Apr 22, 2014

I have issues with this i am new to winsock. so i was learning to use winsock for http POST request

Compiles correctly, but doesnt connect i get the error "Connection Failure" what do you think can be wrong

My code goes like this:

Code: #define WIN32_LEAN_AND_MEAN
#include "stdafx.h"
#include <cstdio>
#include <cstdlib>
#include <Winsock2.h>

[Code] .....

View 1 Replies View Related

C/C++ :: Create App That Uploads A File Using HTTP Request

Oct 18, 2014

I need to create C++ app that uploads a file using http request. I have the following php file on my server:

<?php
$uploaddir = '/var/www/uploaded/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {

[Code] .....

Now, i know the general idea of how its supposed to be done but I just cant get it right. Either my "post" message is wrong all the time or some library is not working properly. Im not even including the code for the application because I have 5 projects, each with different approach and none of them is working.

View 4 Replies View Related

C++ :: Server Request Line Validation?

Oct 30, 2014

I have problems relating the HTTP server request line validation into a c++ code, where the request line is defined as follows:

method SP request-target SP HTTP-version CRLF

and the server supports absolute-path [ "?" query ]

At the same time absolute-path must start with / and might optionally be followed by a ? followed by a query, which may not contain ".

Basically, method must be GET, request-line must begin with / , request-target cannot contain " ,HTTP version must be 1.1 (HTTP/1.1), and the absolute-path must contain the character .

View 1 Replies View Related

C++ :: Client Sends A Request To Server And Get Some Data

Apr 28, 2014

I want to write a little c++ program that sends a request to a server an get some data. I found the C++ Rest-SDK and decided to use it. I searched on different websites for code-examples but many of them doesn't work an shows syntax errors. What i got now is that code but the client.request method is skipped. The program never jumps in.

#include <Windows.h>
#include <iostream>
#include <sstream>
#include <string>
#include "cpprest/containerstream.h"
#include "cpprest/filestream.h"

[Code] .....

View 1 Replies View Related

Visual C++ :: HTTP Flood Code Ported To Bot Source?

May 6, 2013

I am stress testing my webservers and I need to code or port a C++ HTTP GET flood onto this C++ bot sourcecode. I believe I will need GetTickCount so I can specify the duration of the flood as well. I already have the C++ HTTP Flood .cpp and .h files but have no clue how to put it together onto this source. This will be easier to do over Teamviewer as I'm already using C++ 6.0 and have been with no issues.

View 14 Replies View Related

C# :: How To Use Proxy With HttpClient In Portable Library

Feb 23, 2014

I'm using HttpClient class to send request. Now, I want to make HttpClient using proxy by using HttpClientHandler class.

But I can't pass my proxy (IP/URL) to HttpClientHandler's Proxy attribute. What should I do now ?

I'm using Portable Class Library ....

View 2 Replies View Related

C :: Implementing Simple Transparent Proxy With Filtering

Feb 9, 2014

My question is mainly about networks. I wan to implement a simple transparent proxy in C, which will filter the browsed sites according to URL blacklist (check before sending the HTTP request) and keywords in content (check the <meta> in the HTML that was responded).

How can I do this? Listen in a local socket (ex. 8080), set the proxy in my browser and according to the requests that the browser sends to me open a socket with the server, forward the browser's request to the server and forward the server's response to the browser? (Of course by applying filters in the stages where needed.

View 7 Replies View Related

C# :: Accessing Method Within Proxy Class But Fails To Do So

Jun 23, 2014

I have this proxy class generated from a webservice:

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="java:se.atg.aisbean.calendar")]
public partial class RaceDayCalendarSimple : object, System.ComponentModel.INotifyPropertyChanged {

[Code] ....

I'm trying to access this method "RaceDaySimple[] raceDay" and display it on "WebForm1.aspx":

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebServiceClient.WebForm1" %>
<!DOCTYPE html>

[Code] ....

So on "WebForm1.aspx.cs" I'm trying to access the method "RaceDaySimple[] raceDay" and display it inside the div "test":

test.InnerHtml = pbs.fetchRaceDayCalendarSimple().raceDay;

But I'm getting the error:

Cannot implicitly convert 'WebServiceClient.InformationServiceReference.RaceDaySimple[]' to 'String'

So how do I acces this method proparly and display the content on "WebForm1.aspx" inside the div "test"?

View 1 Replies View Related

C++ :: Redirecting Network Traffic (building A Proxy)

Feb 3, 2015

I want to build a proxy, middleman between various client programs on my machine and servers outside, like this:

Client -> Proxy -> Server, Client <- Proxy <- Server.

OSes are Windows XP, 7 and 8.

Within that proxy I want to analyze data before it reaches it's destination and have full control over it to the point where I can prevent a packet from reaching it's destination if my program finds something suspisious going on. I need incoming and outgoing traffic of specific adresses and ports to be forwarded into my application on my client machine. My app then should deliver packets to their destination after they were analyzed.

The parts where data is received, analyzed, manipulated if needed, and sent is something I could code with no difficulty. But the concept of redirecting and forwarding is hard for me to grasp at the moment. I'd like to know at least what winsock functions I have to use.

If it's possible, I would like to use Windows libraries only, nothing from 3rd parties.

View 3 Replies View Related

Visual C++ :: ActiveX For Video Server

Jan 13, 2015

I would like to know in which way is the best to make ActiveX control for video. ActiveX control will need at least show picture and be able to go back in past, change resulation of picture and similar. How complex it is to do something like that? Is MFC best way to make it? Is there somewhere similar code?

View 2 Replies View Related

Visual C++ :: Getting Indexes Information From SQL Server?

Jan 6, 2014

Trying to get table indexes information in SQL Server 2012 I identified a strange situation for one scenarion.I have a table that contains two indexes referenced to some fields: Field_1 and Field_3 mapped over int, null columns (the number means the existing field order into the table designed few years ago...).

I am trying to get information about these indexes like this:

Code:
nRetCode = ::SQLStatistics(hstmtAux, NULL, 0, NULL, 0, (TCHAR*)(LPCTSTR)strTempTable, SQL_NTS, SQL_INDEX_ALL, SQL_ENSURE);
if (nRetCode == SQL_SUCCESS || nRetCode == SQL_SUCCESS_WITH_INFO)
{
nRetCode = ::SQLBindCol(hstmtAux, 4, SQL_C_SHORT, &swNonUnique, sizeof(SWORD), &cbNonUnique);
nRetCode = ::SQLBindCol(hstmtAux, 5, SQL_CHAR, szIdxQualif, sizeof(CHAR) * 130, &cbIdxQualif);
nRetCode = ::SQLBindCol(hstmtAux, 6, SQL_C_CHAR, szIdxName, sizeof(CHAR) * 130, &cbIdxName);
nRetCode = ::SQLBindCol(hstmtAux, 7, SQL_C_SHORT, &swType, sizeof(SWORD), &cbType);
nRetCode = ::SQLBindCol(hstmtAux, 8, SQL_C_SHORT, &swSeqInIdx, sizeof(SWORD), &cbSeqInIdx);
nRetCode = ::SQLBindCol(hstmtAux, 9, SQL_C_CHAR, szIdxColName, sizeof(CHAR) * 130, &cbIdxColName);

[code]....

Becasuse SQLExtendedFetch() is deprecated I used SQLFetchScroll() but the behavior is the same from my interest point of view.

Usally, I get the right information about indexes but in one situation I encounte a strange behavior. It's about having a clustered index into a scenario.
When Field_1 is Non-Unique, Non-Clustered and Field_3 is Clusted index I get the right information.

But if the index Field_1 is Clustered and the Field_3 is Non-Unique, Non-Clustered I get no information about Field_1 index (eg. szIdxName and szIdxColName are "" and their length is -1 that means SQL_NULL_DATA). So, I have no Index information. Within while loop, with the next iteration I get correct information about the second index Field_3.

I'm not sure whether the problem is with SQLStatistics, the bindings or SQLFetchScroll (they all always return SQL_SUCCESS). It looks like a problem with the driver when the first index is clustered.

View 6 Replies View Related

Visual C++ :: Creating A Virtual Mini Server?

Jul 28, 2014

Is it possible to create a virtual mini server (like IIS) that takes http request? I have a toolbar that queries an DLL using http request, and then that DLL stores some arguments in some XML file, which is read by an anti-malware.

Now every customer can't have an IIS server installed. Most of the end users uses Windows XP home edition. So is there a way i can create a virtual mini server that can be used in these PCs for placing http request?

View 14 Replies View Related

C++ :: How To Use Random Response Generator

Jun 3, 2014

I'm trying to use a random response generator. I found a ton of information on this site, and I'm running a (very simple) program that is using 5 responses. My issue is, that every time I run the program (debug in visual express), it generates the same responses, in the same order, every time.

#include <iostream>
#include <string>
using namespace std;
int main() {
string mystr;
cout << "Hello. How are you today?

[Code] .....

View 4 Replies View Related

C++ :: Setting Up Invalid Response

Feb 7, 2013

Basically the whole purpose of this program is to prompt the user to use a calculator. Choices 1-6 are valid, but I want to set it up where selecting any other number outside of 1-6 to be Invalid, and will display an 'Invalid Choice' message, and then go back to the main menu.... The main program does work properly, it's the 'Invalid' setup that is giving me problems

Code:

#include <iostream>
#include <iomanip>
using namespace std;

[Code].....

View 10 Replies View Related

Visual C++ :: How To Insert And Read Image From Database (SQL Server) Using MFC

Jan 25, 2015

How to insert and read images to/from database (sql server) using MFC ?

View 5 Replies View Related

Visual C++ :: Winsock - Accepting Multiple Clients On A Server?

Jun 16, 2013

My problem is that I've created a Client and Server program in which they communicate. The Client is an SDL Application that allows you to play as a movable character IF YOU ARE CONNECTED TO THE SERVER. If not, You're unable to play. THIS WORKS!

However, Only one client is able to play on my server?? Anyone elses' window freezes and they are not allowed to play (As if not connected to the server). Here is my server code.

Code:
#include <iostream>
#include <winsock2.h>
#include <vector>
#include <process.h>
#include "Included/pthread.h"
#define MAX_THREADS 5
bool gamerunning = true;

[Code] ....

I'm having troubles allowing more than one client to play on the server.

View 2 Replies View Related

C# :: Bind XML Response To Grid View

Nov 11, 2014

I have been trying to bind an xml response from a web service to a gridview but to no success. bellow is my code

soapInvoker.setMethod("GetAgentProducts");
XDocument AgentproductsRequest = SoapMethods.GetAgentProducts(pin);
XDocument AgentproductsResponse = soapInvoker.CallSoapServiceInternal(AgentproductsRequest);
XDocument xmlDoc = new XDocument(AgentproductsResponse);
var vrresult = from a in xmlDoc.Descendants("product")

[Code] ....

And I always get an error that is not explained dont know whether is coz i bootstrapped my master page or what but all errors caught where there are it shows this Runtime Error

Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

View 1 Replies View Related

C++ :: Making Automated Response Generator

Dec 12, 2014

Basically I have made a code that generates only one response, I have collected around 100 responses from my friend, and the whole idea is to get a different response every time, doesn't matter what question is asked.

#include <iostream>
#include <string>
#include <ctime>
#include <stdlib.h>
int main () {
srand(time(0));
std::string mystr;

[Code] ....

Here is the link to all the responses I have gathered, just in case [URL] .....

View 11 Replies View Related

Visual C++ :: How To Retrieve Remote Desktop User Domain Name On Win2008 Server

Oct 9, 2012

How can I do this??

Suppose I have Win2008server and many users from defferent domains log in, so every user has its own session.

How can I obtain from the session the domain name of the user who logged in to server??

View 1 Replies View Related

Visual C++ :: Excel Automation - Window Doesn't Come To Foreground In Windows Server 2008

Feb 10, 2014

We have a C++ 5.0 app that does something like this:

Creates the excel dispatch, exports the data, etc...
...
then calls these functions:

xlsApp.SetDisplayAlerts(TRUE);
xlsApp.SetVisible(TRUE);
xlsApp.SetUserControl(TRUE);

This has always worked to display the excel spreadsheet in the foreground, most recently on Windows Server 2003.

Now, testing on Windows Server 2008, the excel spreadsheet is created, but in the background. How to force it to the foreground?

View 2 Replies View Related

C++ :: Passing Page Request Via Php?

Sep 13, 2014

i want to write a c++ program that could pass a web page request, using a php script in a dns server. And also passed by the quested page to the software. What i really want to do is a software that can redirect a page request.

View 1 Replies View Related

C# :: Perform Web Request And Get Results?

Sep 17, 2014

Here is the site that I want to interact Genderchecker

I want to set a value to a specific element in a web site. Perform a click on an element that is image. Get the result <span> text into string variable...

What should I use ?

View 2 Replies View Related

Visual C++ :: How To Change A Button Colour

Jan 16, 2014

May I know how to change a button colour using visual C++ ? Currently using visual studio 2010.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved