Catch url without parameters - regex

I'm having issues catching url while excluding parameters (what's after ? sign)
So for the following links
/alfa/wp-includes/js/jquery/jquery.js
/beta/wp-includes/js/jquery/jquery.js?parameter=value
I need the following
alfa /wp-includes/js/jquery/jquery.js
beta /wp-includes/js/jquery/jquery.js
So far I came up with the following but it always catch full link including parameters, which I don't need
^(/alfa|beta)?(/wp-(content|admin|includes).*)

Try this (assuming your inputs always ended in .js)
(/(alfa|beta)(/wp-(content|admin|includes).*))(\.js|\?)
Or improving upon ctwheels' comment:
^/(alfa|beta)([^?\s]*)(\.js|\?)
I'm not sure if it's 100% what you need but I ran that query in regexpal.com and it works as you described.

Try this :
(\/(alfa|beta)[^\?]+)
https://regex101.com/r/AmgHTS/8

Related

Viewstate Replacing error. [ViewStateException: Invalid viewstate. ]

Tried with JMeter: How to know why my regular expression extractor in JMeter is not extracting the data but still not able to replace my view-state, its throwing [ViewStateException: Invalid viewstate. ] error . Please check the attachment , an my script has not _EVENTVALIDATION .
enter image description hereViewstate
viwstate2
As i am observing from your attached image
You need to pass same `Reference name` as a value of __VIEWSTATE in Next request
First Cross verify, Is your correaltion is correct or not? (you can use debug sampler to check the correlation)
If yes, then first mistake is, you had given reference name as "VIEWSTATE" in below shown snapshot
But you are passing ${jsfViewState} in other snapshot, so correct it and pass same reference name i.e. ${VIEWSTATE}
It'll resolve your issue, if issue still persists then click on encode button beside Name-Value pair because sometimes there is some mismatch in encoding format between the response which we capture and the value which we have to pass
Don't be confused with ASP.NET ViewState and JSF Viewstate, they have similar nature but different underlying technologies and different parameter names
Given you correctly correlated the value, I believe you need to change __VIEWSTATE parameter name to javax.faces.ViewState and it should work.
See Testing a JSF Application with JMeter guide for a little bit more detailed explanation on the topic and How to debug your Apache JMeter script guide for some troubleshooting techniques.

How to use optional parameters in Yii URL Manager?

I have a problem with Yii urlManager.
I have a page that is a list of videos, so I add the following rule:
'videos'=>'video/index'
Now I want to add the page:
'videos_pag<Video_page:\d+>'=>'video/index'
Is there a way in order to put the two rules together?
I tried this:
'videos(_pag<Video_page:\d+>)?'=>'video/index',
but it does not work properly.
Use two lines, if first fails, second will work (if everything correct) :)
'videos_pag<Video_page:\d+>'=>'video/index',
'videos'=>'video/index',

Hash anchor tag causing errors in URL

On very rate occasions, my error log is showing the following error:
"You specified a Fuseaction of registrationaction#close which is not defined in Circuit public."
The full link is:"http://myUrl/index.cfm?do=public.registrationAction#close"
As you can see, the has merely points to an anchor (close) on the page.
This code is working 99% of the time, but on the odd occasion, Coldfusion / Fusebox throws this error out.
Why is this happening?
Could it be related to the device accessing my page somehow? Like a cell phone or Apple product that for some reason does handle hashes the way I am expecting it to?
Could it be javascript / JQuery being disabled?
Any guidance would be appreciated
Thanks
I used to see stuff like that. Older versions of Internet Explorer were not handling the hashtag properly when there were URL parameters. The best solution I could come up with was kludgey at best, but basically it forced the anchor tag to separate from the URL parameter.
http://myUrl/index.cfm?do=public.registrationAction&#close
I'm not sure there is a simple answer to this. We get odd exceptions all the time on our site for all sorts of reasons. Sometimes it's people not using the site the way you expect and sometimes it stuff like you mention such as user-agent edge cases etc.
Basically you need to start to gather evidence and see what comes up that's unusual with these requests.
So to start: do you catch exceptions in you application? If so dumping all scopes (CGI/CLIENT/FORM/URL/SESSION) in an email along with the full exception and emailing them to a custom emails address (such as errors#yourdomain.com) will give you a reference you can square up to your error times and this might give you a hint as to the real issue.
Hope that helps some!

cakePHP, encoding problem when using find+list, no problem when using find+all

Well, I've configured the database.php file, added the 'encoding'=>'utf8' option.
also added the $this->charset('utf8') to my view.
Now, when I use the find('list') and echo its content I get those known question-marks. But, when I use the find('all) method, the data is delivered correctly.
And my questions are:
Why?
Who is to blame?
How to solve ?(I really prefer the list way..)
Should I drink more coffee?
can you try $this->find('all') and then use set to extract the values, like Set::extract('/Post/title', $posts); and print it out. if the find all was good and the set::extract is bad there could be a bug. If it works like normal then there is something weird as that is what the core does.

Django url debugger

I'm developing a django application and over time, the URLs have grown. I have a lot of them with me now and due to some change I made, one view started to malfunction. When I try to GET http://example.com/foo/edit_profile, it's supposed to execute a view certain view function X but it's executing Y instead. Somewhere the url routing is messing up and I can't figure it out. I used the django.core.urlresolvers.resolve method to try it from the shell and I can confirm that the URL is getting wrongly resolved. However, I don't know how to debug this and pinpoint the problem.
Ideally, I'd like to see something like "tested this pattern", "tested this pattern" etc. till it finally finds the correct one and I can then look around where it resolved. I can't find anything like this.
Isn't this a common problem for larger projects? What do people do?
Update
I know how the system works and how to look through the URLs one by one. That's what I'm trying to do. This question is basically asking for a shortcut.
have you already tried to run
manage.py show_urls
after installing django_extensions?
http://vimeo.com/1720508 - watch from 06:58.
This should give you in what order the url resolution is attempted.
Hope this helps
I would comment out the patterns in your url.py until you get a 404 error when you try to navigate to foo. If that pattern is an include, I would recurse down that and comment out lines in that url.py. Eventually you will know exactly which pattern is matching.
Then I would take the view function that it is calling and hard code that. If it is using a generic view or something subtle, I'd make it as obvious and direct as possible. At that point, you should know which rule is matching and why and what code it is executing in the view.
You can assume, that it goes through the urlpatterns from top to bottom and the first one that matches will be executed.
As you know which view is executed (Y) think about that:
if Y is before X: the patterns of Y matches the url (but shouldn't)
if X is before Y: the patterns of X doesn't match the url (but should)
Can you provide some more explicit examples of your URLConf? Than I can give you a more explicit answer.
Look at your urlconfs, find which urlpattern invokes your view Y and see if the regexp is more general than it ought to be. Try to comment out the urlpattern which causes the false match and see if it correctly matches X.
Typically, this is not a problem for me, but it does occur. Always keep more specific patterns before general ones. Use static prefixes to divide your url namespace, to prevent false matches.