473,725 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to modify the Request-Line ?

Is it possible to modify the Request-Line of an HTTP response ?
I'd like to remove the parameters from a GET url.

More precisely, I wish I could replace :
[From Req: GET /myuri?key1=val1 HTTP/1.1]
with :
[From Req: GET /myuri HTTP/1.1]
The "Header" function doesn't seem to allow this.

Thanks.

Jul 17 '05 #1
5 2072
patrice wrote:
Is it possible to modify the Request-Line of an HTTP response ?
I'd like to remove the parameters from a GET url.


If I'm not mistaken, the Request-Line is in the incoming HTTP request,
not the response.

What would be the point in altering it once it's arrived? If you don't
want to use the GET parameters, then don't!

Or am I misunderstandin g you?

--
Oli

Jul 17 '05 #2
patrice wrote:
Is it possible to modify the Request-Line of an HTTP response ?
I'd like to remove the parameters from a GET url.

More precisely, I wish I could replace :
[From Req: GET /myuri?key1=val1 HTTP/1.1]
with :
[From Req: GET /myuri HTTP/1.1]
The "Header" function doesn't seem to allow this.


This is usually done through a Location: header, which is received by the
browser and translated into a new GET request with the URL defined by this
header. Example:

<?php

if ($_REQUEST['QUERY_STRING']) {
header("Locatio n: http://mysite.com/myuri/");
exit;
}

?>
JW

Jul 17 '05 #3
My aim is as follow : I want to use a form and a javascript
location.replac e() together, in order to replace the curent page in the
browser's history list.
So I'm forced to use the GET method (there doesn't seem to be a way to
achieve this through location.replac e when using the POST method).
But when using GET, the parameters will appear at the end of the URL
displayed in the client's browser, which I don't want. This URL is the
one returned by the server's response and could be different from the
one appearing in the request (I need to check this however). So if I
could remove the parameters from the Request-Line sent to the client,
it would be OK : the client wouldn't see the parameters in the url but
I still could use the GET parameters through $_GET for instance.
I cannot use a :
header("Locatio n: http://mysite.com/myuri/");
exit;

because it works differently ; it first sends the new location to the
client which then requests the new page. It costs a second
request-response exchange. Further more, in [From Req: GET
/myuri?key1=val1 HTTP/1.1], the key1=val1 is a true parameter, not an
url. I'm not interested in doing on the fly url translation.
Removing the parameters from the url with Apache's rewriting module
wont do it neither, because PHP would in this case never receive the
parameters.
So modifying the request-line with PHP - if possible - is the only
solution I've found till now.

Patrice

Jul 17 '05 #4
patrice said the following on 05/06/2005 08:43:
My aim is as follow : I want to use a form and a javascript
location.replac e() together, in order to replace the curent page in the
browser's history list.
Why? Sites that try to take control of the user's browser are usually
just a pain in the arse.

Plus if the user has JS disabled, your page won't work at all...
So I'm forced to use the GET method (there doesn't seem to be a way to
achieve this through location.replac e when using the POST method).
But when using GET, the parameters will appear at the end of the URL
displayed in the client's browser, which I don't want. This URL is the
one returned by the server's response and could be different from the
one appearing in the request (I need to check this however). So if I
could remove the parameters from the Request-Line sent to the client,


As I've already said, the Request-Line is *not* part of the server's
HTTP response, but part of the client's (browser's) HTTP request.

The only time the server sends back a URL (that appears in the browser)
in an HTTP response is in a Location header.

--------------------

Off the top of my head, the only way that I could see to do this (and
it's messy), is:

* Do the location.replac e(), with the form variables in the GET string.

* Then have the server collect up all the submitted $_GET variables and
dump then in $_SESSION.

* Do a header("Locatio n: http://example.com/simple_url/") redirect.

* At the new location, pick up the variables from the $_SESSION variable.

This is untested.
--
Oli
Jul 17 '05 #5
Oli Filth wrote :
As I've already said, the Request-Line is *not* part of the server's
HTTP response, but part of the client's (browser's) HTTP request.


I was mislead by the results of HTTP Interceptor (which adds the
Request-Line in the response to track messages more easily).

Sorry for all this.

Thanks.

Jul 17 '05 #6

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

Similar topics

1
7131
by: Glenn | last post by:
Searching through google groups, I have not found anyone able to modify the query string of a request. I was hoping to make the query string as short as possible so that a search with many criteria could be bookmarked. I had planned to have the query string be key=value for each criteria But with dropdowns, the default choice is always submitted. There were other parameters that I had to use that were longer than I hoped. And...
16
2921
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the form order to do that ? My point is for the client to be able to re-read the modified data.
0
1269
by: Kevin | last post by:
I am successfully creating and deleting appointments and sending invitations in a C# / ASP.NET / Exchange2000 environment. It works great! But the problem is that no notifications are sent out when I programmatically delete or modify appointments. This is a key feature that we will need and I am looking for information/documentation on how to send these notifications programatically. The code below is what I'm using to delete a...
3
1352
by: Marc Gingras | last post by:
Hi, I tried to modify the request object when my aspx page is loaded(or before). When I try to do it a received a "Read only" error message. Is it possible to modify a Request when the server received it? What I want to do is something like that: Me.Request.form.Item("Name")="NewName" If I can do it this way, How can I do it otherwise?
1
2918
by: Henry | last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any help would be great. What I have is a dataset in a session variable. Here is what I have done to stored into the dataset via store procedure. Sample Stored Procedure: CREATE PROCEDURE prcGetData AS
6
6091
by: Dave Slinn | last post by:
I have a VB app hosting the Webbrowser control. I would like to add "something" to the requests that app is submitted to our web application to indicate that its from this webbrowser and not a separate instance of IE. Is this possible, keeping in mind that I cannot add anything to the registry, since a user may still use IE to visit the web app.
1
1711
by: ABCL | last post by:
Hi all I am develoing Asp.net application, but want to make it secure.. Is there anyway that I can Modify/Remove Request Header which contains some User related data? Thanks In Advanace Thanks for your time ABCL
20
2352
idsanjeev
by: idsanjeev | last post by:
hello i want to modify multiple rows in database with select option i am using R.update but it can update only one record in database but i wants to more then one record is modify after submit so what code i have to use i am using <% If Not IsEmpty(Request.Form("submit")) then vopenflg = Request.Form("vopenflg") vopenflg=trim(vopenflg) conn.close conn.Mode = adModeReadWrite conn.open
0
1892
by: Sanjib Biswas | last post by:
Hi, I have an ASP.Net application which talks to an ASP application. As the ASP.Net application talk to the ASP application, the REMOTE_ADDR server variable points to the IP address of the ASP.Net application. I would like to modify server variables to point to the actual client IP address rather than ASP.Net application. Client -ASP.Net (Web application) -ASP (Web application)
3
1305
mickey0
by: mickey0 | last post by:
hello, I read this server class, and I'm wondering how modify it in a way that the server can serve more than one request. link Could anyone get me a hint, please?
0
8889
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9116
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2157
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.