I'm writing a WebDAV server and encountered the following problem. Mac OS X clients (Finder, Microsoft Office for Mac) generate too many different requests. I had the same problem with Microsoft Word for Windows, but after setting custom headers:
Ms-Author-Via: DAV
Microsoft Word started using much more limited number of requests. Here's how
Microsoft Word editing session looks on Windows (and Windows or Linux with LibreOffice):
PROPFIND
GET
LOCK (windows only)
PUT
UNLOCK (windows only)
PROPFIND (linux only)
Mac OS Finder and Office for Mac however generate a lot of additional requests, namely:
Generation of temporary files
Generation of temporary folders
Moving them around
Is there some header combination that reduces a number of requests in Mac OS X?
After some research, it sadly looks a lot like this were beyond the powers of some HTTP headers. It is also a somewhat known issue as this owncloud issue and this document in the sabre DAV documentation shows. Apple's solution to this is by disabling temporary file creation altogether through the following command:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
However, it sounds like you will have to cater to the needs of many clients outside of your control, which makes this impractical. Owncloud has tackled this by mocking successfull LOCK/UNLOCKs for finder, turning these requests essentially into NOPs. A less subtle approach were to forcefully prevent creation of these files in the first place. On a personal note, I feel a mix of Owncloud's approach combined with a .metadata_never_index file were most promising and largely free of undesired side-effects.
Related
This is my first question on SO, and I am have tried to avoid it, but am forced to ask. I can't use FTP, as that's insecure. I can't use FTPS, as I can't introduce expiring cert overhead. WEBDAV over https isn't an option.
What would be ideal would be a firewall friendly robocopy, as that uses windows auth.
I am looking at powershell with BITS, but can't find what port it's using or it's requirements on Windows 2012 exclusively. Older systems have stated requirements that they need IIS, but I can't find that stated on Microsoft's sites anywhere:
https://www.google.com/search?hl=en&q=site%3Amicrosoft.com%20windows%202012%20bits
I looked on here and found 56 articles related to BITS. Example: How to use BITS in Powershell to upload / download files?
I tried performing the file transfer with powershell without caring about the port, but the automation of this is problematic, as I keep getting an error:
The operation being requested was not performed because
the user has not logged on to the network. The specified service does not
exist. (Exception from HRESULT: 0x800704DD)
And ultimately, the port matters because I have to go through a firewall.
I don't want to make an assumption that the requirements from earlier versions of BITS still apply, because Murhphy's Law says I will be burned by it.
Does anyone has a possible solution to this problem? One that doesn't involve the purchase or use of non-native tools. On Linux, I would solve this with SSH, exchange some keys, and it just works. Is there anything in the windows platform that does something similar and is native to the OS?
Here's one way:
http://www.nivot.org/post/2009/11/02/PowerShell20IntroducingThePModemFileTransferProtocol
It works over a WSMAN/PSRemoting session, so you can specify the port, use HTTPS.
Many questions on SO say "Windows developer guidelines" or "windows design guidelines" say that you shouldn't write temporary or program data to the Program Files area, but as far as I can tell none of them actually link to a piece of documentation that says as much. Searching the MSDN has yielded me no results. Windows will make the area read-only, so it can be enforced by the OS, but that doesn't mean developers didn't try to write there anyway (e.g., when porting older, XP and earlier based programs forward.)
I realize that it seems odd to ask about it this late into Windows development (since, as a commenter below pointed out, has been enforced by the OS for more than a decade), but a document that says so is sometimes necessary to satisfy people.
With that in mind, Does Microsoft have a document published stating we shouldn't write application data to the Program Files area, and if so, where is it?
From Technical requirements for the Windows 7 Client Software Logo Program:
Install to the correct folders by default
Users should have a consistent and secure experience with the default
installation location of files, while maintaining the option to
install an application to the location they choose. It is also
necessary to store application data in the correct location to allow
several people to use the same computer without corrupting or
overwriting each other's data and settings.
Windows provides specific locations in the file system to store
programs and software components, shared application data, and
application data specific to a user:
Applications should be installed to the Program Files folder by default. User data or application data must never be stored in this
location because of the security permissions configured for this
folder (emphasis added)
All application data that must be shared among users on the computer should be stored within ProgramData
All application data exclusive to a specific user and not to be shared with other users of the computer must be stored in
Users\<username>\AppData
Never write directly to the "Windows" directory and or subdirectories. Use the correct methods for installing files, such as
fonts or drivers
In “per-machine” installations, user data must be written at first run and not during the installation. This is because there is no
correct user location to store data at time of installation. Attempts
by an application to modify default association behaviors at a machine
level after installation will be unsuccessful. Instead, defaults must
be claimed on a per-user level, which prevents multiple users from
overwriting each other's defaults.
And I'm quite sure that there's similar stuff for every Windows version of the NT family going back to Windows NT 4 or even earlier.
See also this question.
Edit: the original link in this post to the Windows 7 Logo program exists no more. Here you find the current link to the Certification requirements for Windows Desktop Apps. See Section 10, Apps must install to the correct folders by default
In later versions of windows (Vista, 7 and of course server versions) access permission are restricted for "special folders" including "Program Files". Even if your program is elevated to have sufficient privileges to write to this folder it is still a bad idea.
I don't know of any guidelines that state this but there is a list of special folders and what they are meant for. The fact that there is a special folder for nearly all types of data I can image means there is no need to use the program files folder.
I'm currently developing an iPhone App and my company uses TFS 2010 for source control.
We're using Team Explorer Everywhere as an Eclipse plugin to handle source control on the Mac and for other projects (like a C++ project we recently did) it works fine.
However it doesn't appear to work for this iPhone App and the main reason appears to be Aliases. It either won't store them at all or it will store them as a regular file or folder, which breaks everything.
Prior to this attempt to move to TFS I was using Mercurial in an impromptu fashion and everything just worked.
Does anyone know how to store things like Aliases from a Mac OS X machine in TFS without breaking them?
Aliases on the Mac OS are a hybrid of a sym link as well as a pointer to the source's File ID. (think of it like a pointer to the inode as well as a sym link to the full path on a traditional unix file system)
It's actually more complicated than that since the implementation of the alias structure depends on the underlying file system. This is all documented in the Overview of the Alias Manager Reference
It really boils down to how TFS 2010 is exposing it's file store to the Mac OS - my guess is that it's a SMB share and that's why your aliases are failing to survive the translation from HFS+ to NTFS storage through a SMB API. Unless you can expose the raw storage as HFS+/AFS and TFA 2010 can intelligently track the file changes, you might be out of luck and have to avoid aliases all together. Relative path sym links might be a more robust solution if you care to try that.
You'll give up all the robustness of alias reconnection on the Mac side, but control over your code changes might be more important. I'd also look into a mercurial or git bridge to TFS 2010 as they work better on the mac and might be a more acceptable middle ground.
Yes, Team Explorer Everywhere can preserve HFS Aliases. HFS stores Aliases in the file's extended attributes:
% ls -Flas alias
208 -rw-r--r--# 1 ethomson staff 69936 May 30 15:19 alias
% xattr alias
com.apple.FinderInfo
com.apple.ResourceFork
Team Explorer Everywhere will store extended attributes when the .tpattributes file is properly configured. To store extended attributes, you will need a line such as:
filename:transform=apple
When this transformation is applied, the local file's data and resource forks are combined into an AppleSingle file, which is then checked in to TFS. When you perform a get on that file from Team Explorer on another Mac computer, the Alias will be correctly preserved. On any non-Mac computer, this flag is ignored and the actual AppleSingle file itself will be downloaded.
The answer, near as I've been able to tell, is no.
Not until TFS 2011 at least, according to this
I would like to be be able to invoke a virus check as the final stage of the build process (please don't question why a dev machine would get a virus, it's just a belt-and-braces approach to avoid the risk of getting sued by customers...). Also I'd like the option of having AV on a machine but switching the auto file system protection off (at least for the build directories).
What I would like is a generic way of scanning a file using whatever AV system is in place. I'm assuming that there's an Windows API to do this, given that Windows detects the presence of an AV system, and browsers such as Firefox invoke a virus scan whenever a file is downloaded. So what's the API that they're using? There's the Microsoft AntiVirus API but that seems to be specific to Office documents. Does the approach involve using WMI? (and if you can detect the AV provider from there, how do you then invoke it to scan a file?)
I know that I could write the script to manually call the AV scanner that I know to be installed, but as an intellectual exercise I'm more interested to know how apps like Firefox are doing this.
Well, you may want to take a look at the nsDownloadScanner system directly on the Firefox source code:
nsDownloadScanner.h
nsDownloadScanner.cpp
As told by the comments on that files:
Download scanner attempts to make use of one of two different
virus scanning interfaces available on Windows - IOfficeAntiVirus
(Windows 95/NT 4 and IE 5) and IAttachmentExecute (XPSP2 and up).
The latter interface supports calling IOfficeAntiVirus internally,
while also adding support for XPSP2+ ADS forks which define security
related prompting on downloaded content.
Documentations on those interfaces can be found here:
IAttachmentExecute
IOfficeAntiVirus
If your software is open-source is compliant with the MPL licence (thanks, #MSalters), you may also directly use Firefox' code, to avoid reinventing the wheel.
Firefox uses the IAttachmentExecute API. However, you don't want to use that in a build script since it will add alternate stream information telling windows to show an annoying warning window when executing the file.
I'm finding an non-daemon, interactive-mode only, portable(moveable) FTP server for Mac OS X.
Like MAMP.
This will be used temporarily for local development only. Not for service.
Just file listing and serving(download) features required. Complex features like account management or SSL are not required.
This should be run as an UI application, and should not depend on system setting. Whole server should possible to be moved with only folder copying.
Is there a solution like this?
Woof is a web not ftp server. Minimal and almost trivial to use. Depending on you use case it might work for you.