shellexecute fails to open http links for some users - delphi

Some users of an app of mine are reporting links dont open in the browser. I always launch them with shellexecute(0, 'open', 'http://...
what could I check for an incorrect(?) setting in the http link associations?

You're assuming that the browser registered the open verb. It may not have done so.
Just pass nil as the second parameter and omit the open, and let the OS determine what the default action is for the http:// protocol, and you should be fine.

Sounds like the default browser is not functioning quite right. I guess the first thing I would try is to have them enter an (any) url into start->run and see if that pops up.
You could also have them register what the settings on the URL below are:
http://russenreaktor.wordpress.com/2010/07/01/solved-fix-default-protocol-http-association-in-windows/
Or use the ftype utility on the cmdline:
C:\Users\marco>ftype http
http="C:\Program Files (x86)\Internet Explorer\iexplore.exe" -nohome
These operate on registry keys under HKEY_CLASSES_ROOT/protocolname with protocolname=http/ftp etc.
Making a simple app to dump these keys might help finding out what the pattern here is.

FYI, this failure can be dynamic -- i.e., the old MS PhotoEditor would block opening URLS using ShellExecute. (C.f., http://code.activestate.com/recipes/334665/ ). Fix is as noted in the recipe: write out an .HTML file and shellexecute that.

Related

Running graphgists locally fails

I'm interested in running a graphgist locally, for which there is a script here:
https://gist.github.com/jexp/70296ce410ff431ddbef
I was able to install the modules and run the two tasks but the last line of the script:
open http://localhost:8000/?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc
produces an error: Not Found and trying to open the link in the comments:
http://localhost:8000/gists/my-graph-use-case.adoc
causes my browser to download a file for which I have no associated application. has anyone made this work and if so, how?
according to #MichaelHunger the issue is that the default behaviour in Python's SimpleHTTPServer is such that a trailing slash (/) gets added to the end of the url, messing up the request.
according to #PratikMandrekar, in the following article, the problem is that the url as it is in the script does not explicitly specify the file name, forcing the server to redirect to the default. see:
Why does SimpleHTTPServer redirect to ?querystring/ when I request ?querystring?
so after a little experimentation I found this to work:
http://localhost:8000/index.html?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc
notice that the colons, slashes, etc. in the inner url must be encoded for this to work
There is a bug/default behavior in simple-http-client that makes it add slashes after query parameters which breaks our app in this case, I have to find a better replacement or fix it.
Perhaps I can also change the rabbithole project to server the graphgist files itself, so that it would be self-contained.

Validate URL on iOS for multi-part URL

We're (me, a colleague and an outsourced dev) building an iOS webDav navigation App which we believe is having trouble validating a URL.
We're accessing a webdav server via the app. One of servers which is https://webdav.microdigit.org.uk/test/ works perfectly.
However our main server which is https://vpn.westbuckland.devon.sch.uk/webdav/ doesn't work.
It seems to be due to the extra dot in the URL but we're not sure.
This is our current expression:
NSString *myregex = #"\\bhttps?://[a-zA-Z0-9\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():#\\\\]*)+)?";
It just seems odd that the app will connect to a standard length URL such as https://vpn.something.com/ or even starting from a subfolder such as https://vpn.something.com/webdav/
You can then go one more and add another "dot" to the URL such as https://vpn.something.org.uk/webdav
However when you go one further it will connect to https://vpn.something.edu.org.uk/webdav/ but when you start trying to load a file or navigate the file structure, it reports a 404 in the debugger as if the files are not found.
Is it the extra dot in the URL? It seems to be the only thing we can think of. Our outsource dev has been pretty good so far in debugging most of our code (which was a purchased fully licensed base) but we're now reaching the end of the road. If anyone believes it is the regex expression. What would someone recommend we use instead?

utf-8 url problem

I have a tomcat (7) server running, through which I try to access some public files by http. Some of the files on the filesystem have special characters in them. The ones without those special characters are found. The other ones give a 404. For example:
http://localhost:9090/processed/transcoded/Csángó_TÖMEGKERESZTELŐVEL_EGYBEKÖTÖTT_búcsú_Istensegítsfalvá20111053491309424029417_extracted.mp3"
From what I found out utf-8 in urls shouldn't be a problem. I've tried an url escape function on the filename, which resulted in:
http://localhost:9090/processed/transcoded/Cs%c3%a1ng%c3%b3_T%c3%96MEGKERESZTEL%c5%90VEL_EGYBEK%c3%96T%c3%96TT_b%c3%bacs%c3%ba_Istenseg%c3%adtsfalv%c3%a120111053491309424029417_extracted%2emp3
... but that didn't seem to solve anything either. What to try next? I have no clue what the problem is. Is it maybe related to a Tomcat settings?
Do you have URIEncoding="UTF-8" in your <Connector? If yes, here's what I would do:
create a test webapp which has a filter intercepting all calls to /processed/transcoded/*
place a breakpoint on that filter and see what you get. Does the file name make sense when decoded?
try to open a new java.io.File using this path (obviously prepending local location, e.g. /home/someuser/files/... and assuming the file is there).
I don't think tomcat does much more than what is listed above.
Another alternative would be to debug the Tomcat itself.

Serving Excel File in MVC

I'm in Internet Explorer 8, using MVC 1 and IIS 7.
I have an action on a controller which serves up an excel file.
I go to the action, a dialog pops up asking if I want to save or open the file, and I select open.
Then Excel makes a HEAD request to the server, followed by opening up a password prompt, then goes up a directory and makes an OPTIONS request, followed by 5 PROPFIND requests. Then if I cancel the password prompt, the excel document opens fine, and makes one final HEAD request to the original directory.
What is going on, and how do I stop it? Can I do something in global.asax or my web.config to mass block all these HEAD/OPTIONS/PROPFIND requests that excel is making? I don't have access to make changes to the web server.
This occurs in office documents where the microsoft programs try to open the file from the server itself. It then tries to authenticate and sends requests such as OPTIONS and PROPFIND to get the server type and tool available to do live editing and updating the local copy from the server, etc. Basically, its done for synchronization.
How do you stop it? no idea, probably have to look at the settings in your local excel tool.
How do you block specific requests in global.ascx? Whats the advantage of blocking it instead of just leaving it, its not like your application is using the request anyways. I'd like to see an answer for this though.

How can step through an Action that is requested from JavaScript during execution?

There is this one action that is requested using javascript during the loading of a page, it takes over 25 seconds to resolve. Looking at the code makes me think there is a scaling issue, but I am wondering if there is any way I can step through the code during the request so I can see what is happening. I try clicking 'debug/start debugging' but it won't launch the proper URL (access to the site is subdomain based), and it will also not find certain dependencies. I am able to browse the site directly via URL locally after mapping a URL via my hosts file to localhost (127...) but the default url that pops up (localhost...) from debug does not work because it is not formatted properly.
Any ideas?
You can attach the debugger to your browser by selecting "Attach to process" under "Debug" menu.
In the past, at least with ASP.NET we have used tracing to debug issues. You will just need to enable it in the webconfig. If you use warn, the messages will show in red and be easier to spot.

Resources