473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request-URI

Hi all,

I am having a problem when trying to use XMLHttpRequest with a proxy
server. The issue is that I want to change the Request-URI from the
header. Here is part of the code:

var url = "http://1.1.1.1:6061";
var host = "2.2.2.2:80 ";

....
req.open("POST" , url, false);
req.setRequestH eader("Host", host);
....
req.send(data);
....

What I want to do is to send this packet to the "url" proxy server,
and have it redirected to the "host" IP and port address. The header
that is being sent is as following:
POST / HTTP/1.1
....
Host: 1.1.1.1
But I want this to be this way:
POST http://2.2.2.2:80/ HTTP/1.1
....
Host: 2.2.2.2

I've tried many ways to do that but with no success:

req.open("POST\ x09http://"+host+"/\x09HTTP/1.1", url, false);
req.open("POST\ thttp://"+host+"/\tHTTP/1.1", url, false);
req.setRequestH eader("Request-Line","POST http://"+host+"/ HTTP/1.1");
req.setRequestH eader("Method", "POST http://"+host+"/ HTTP/1.1");
Does anyone know a solution to that? If I set my IE proxy to the "url"
address, set the "url" to the "host" address and then initialize the
script then it works, but I don't want to set the proxy.

Thanks,

Rodrigo

Jan 22 '08 #1
1 7541
Rodrigo Brayner wrote:
I am having a problem when trying to use XMLHttpRequest with a proxy
server. The issue is that I want to change the Request-URI from the
header. Here is part of the code:

var url = "http://1.1.1.1:6061";
var host = "2.2.2.2:80 ";

...
req.open("POST" , url, false);
req.setRequestH eader("Host", host);
...
req.send(data);
...

What I want to do is to send this packet to the "url" proxy server,
and have it redirected to the "host" IP and port address. The header
that is being sent is as following:

POST / HTTP/1.1
...
Host: 1.1.1.1

But I want this to be this way:

POST http://2.2.2.2:80/ HTTP/1.1
`:80' would be superfluous here.
...
Host: 2.2.2.2
Tough luck. The `Host' header is set by the HTTP client as obtained from
the request URL which is not part of the request.
I've tried many ways to do that but with no success:
[...]
No surprise here, that is pure fantasy syntax. The first argument of
XHR::open() specifies only the HTTP method, not the HTTP command line.
Does anyone know a solution to that? If I set my IE proxy to the "url"
address, set the "url" to the "host" address and then initialize the
script then it works, but I don't want to set the proxy.
You have to access the HTTP proxy instead of the original server which can
then rewrite the request accordingly. While any Web server that supports
that suffices (such as Apache 1.3+ with the Rewrite* directives and the
`proxy' parameter for the RewriteRule directive), if the proxy server runs
on a different machine, it may be possible to trigger that with a URI; I
have seen e.g. http://http%3A%2F%2Fhost%2F@proxy:6061/ before.
PointedEars
Jan 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2190
by: Jack | last post by:
Hi, I am trying to get a thorough understanding of a code where a addition or deletion of records can be done from a list of records. For addition part of the form, data is being obtained from set of input boxes. The following is the code being used: If Len(Request.Form("ID_0"))>0 Then AuthorID=Request.Form("ID_0")...
4
2877
by: SP | last post by:
Hi I have a problem with a customer's XML being submitting to me in a non-well-format XML. They said that there are 18 other partners who has been able to tweak the XML to make it work. So I guess here is my question, in ASP, when working with XML, how do you handle non-well-formed XML documents on the "listener" response side? Here's the...
7
4123
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge is how to corelate the response to a corresponding request. I am looking for a sure proof threadsafe way to corelate a response to a coresponding...
4
1568
by: Nalaka | last post by:
Hi, I have some request specific data that gets created in a "early event", that I need to pass around to many other events. I need access to this data during that request. (and more importantly disapears after the request is completed). But... asp.net "Request" is read only. Is there a request specific global place, where I can put this...
5
20054
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url,...
4
3744
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at the end of the loop and the value of x3 as not all options may be selected from the form yet the loop goes through the entire request.form list ...
6
4964
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am using Ajax. kindly advice me.
2
6285
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata enctype="multipart/form-data" method="post" name="testform">
5
6119
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a...
3
1767
by: Joseph Geretz | last post by:
I'm using the Request Filter documentation which can be found here: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx In this example, two filters are installed, one filter uppercases every alphabetic character and then the second filter replaces every 'E' with "#'. OK, very nice. What's trivial about these...
0
7541
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7734
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7826
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5107
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.