Question

Suppose for any url if a '//' is added instead on '/' by accident in the request. Can this effect the http request performance?

e.g.

  1. http://www.microsoft.com/downloads
    v/s
  2. http://www.microsoft.com//downloads

This reason I am asking this is; in one of our application the dynamic urls were building wrong on production server for some reason. We are fixing this issue but in the mean time I am really concern about what are the possible problem that may occur due to this?

Was it helpful?

Solution

Well I don't know how exactly the URL is parsed server-side, but yes there will probably be a performance impact.

Or, well, impact is not the right word. It'll be a like a miniscule fly biting a massive mammoth...so you shouldn't really worry about it.

Of course, aside from performance, it would be nicer to just link to the correct URL. There might be other effects, and the URL might not work in the future.

OTHER TIPS

It's just coincidence that your URL's provided are redirecting to something that makes sense. If that is not the url you will get 404 on alot of servers.

http://slashdot.org/recent/

http://slashdot.org//recent/

Especially when you consider all the URL rewriting going on these days.

I have rewrite's that are like : ^http://site.com/directory/{0,1}$

Which would give you a nice 404 ;)

The url you have posted does have a performance impact (ignoring the //). The fact that the url uses a re-direct (301 code) will slow the performance down as it re-directs from http://www.microsoft.com/downloads to http://www.microsoft.com/downloads/en/default.aspx.

This also happens when you forget to add the last trailing slash.

I'm pretty sure that the performance impact is negligible or does not even exist.

Trying with Firefox, seems that FF ask for GET http://www.microsoft.com//downloads receive a 301 Moved permanently and then FF ask for the correct address (and in this very case it receive another 301 pointing to http://www.microsoft.com/downloads/en/default.aspx) so yes, there is performance issue, server stress and is a wrong behaviour

(and probably different server configuration could act differently)

No, there is no difference. Or at least you cannot appreciate the difference. Just compare doing

ls /<any-path>/myFile

with

ls /<any-path>//myFile

Luis

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top