Solved

Is there a restriction on the size of a URL/Query string?

Posted on 2001-08-02
6
225 Views
Last Modified: 2013-12-25
Hi,

I have come across web servers that truncate the query parameters present in the url (e.g. http://mypage.com/myPage.jsp?arg1=23&arg2=45) if the whole string exceeds a size limit?

Is there any such limit in HTTP protocol, if yes what is the limit and where is it defined?  Has anybody experienced such stuff?  Is it a browser problem, if yes, do IE and NN both do that?

I would really appreciate a quick response.

Thanks,

KM
0
Comment
Question by:kmahmood
6 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 6350500
It depends on how the data is passed to the page, if the <form> field uses POST, then the limit is 254 characters.  GET allows something like 64k.

I do not recommend passing anything more that 254 characters in the URL string, more than that can cause a bind on the server.  If you have to, use Sessions, Cookies, or hidden field parameters instead.

IE is a little more forgiving than NN, (not sure about NN6 though).
0
 
LVL 1

Accepted Solution

by:
gordonmcmullan earned 20 total points
ID: 6400215
Hi,

I think you have this the wrong way round.

GET requests should be kept below 255 characters.

A GET request is encoded into the URL submitted to a server whilst a POST request is contained in the data section of the request.

There are some browsers, proxies, caches, etc out there that truncate URL's over 255 characters, thus affecting the GET request. If you are expecting to exceed 255 characters in your data then use POST when submitting your request. (note: URL encoding for characters not allowed in URLs may increase the size of the URL you need)

This does have a downside as the request is no longer bookmarkable.

255 characters gives a fairly long string is this the limit you are seeing?

Gordon McMullan
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6400458
DOH, your right... Thanks Gordon.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 5

Expert Comment

by:raizon
ID: 6450793
The HTTP protocol itself doesn't restrict the limit the size of the query string.  Its the browsers that do.  IE limits it to essentially 3k, where with Netscape I havn't been able to find any information on what the limit is.
0
 
LVL 18

Expert Comment

by:bruno
ID: 6840817
Hello,

This question has been open for quite a while now and needs to be wrapped up.

Please do NOT accept this comment as an answer, as I am simply trying to alert those involved that the
question is still open.

If any of the experts could come back and post any suggestions as to how they feel this could be wrapped
up (delete, 0 PAQ, award points, etc), I'm sure the moderators would appreciate it.

Thank you,

BRUNO
0
 
LVL 5

Expert Comment

by:raizon
ID: 6841578
I vote for a delete.  There really isn't any information worth  a 0 PAQ.  Either that or split the points between gordon and mgfranz
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now