Locking for Creating and Writing Files – Zognot.org
A discussion surrounding file locking and atomicity when creating and writing files in python.
Archive for April, 2009Locking for Creating and Writing Files – Zognot.org Proper file overwrites in Python – Patrice’s Weblog BrowserCouch Documentation thekua.com@rest » A Retrospective Timeline We have a javascript application that uses OAuth to speak to some of our backend web services. Everything worked fine in our test environment, but when accessed from the customer site we were having intermediate problem where the OAuth authenticated requests (they were XHR requests) were being denied. This turned out to be happening because the Authorization headers that were suppose to contain the OAuth parameters were sporadically being dropped. Mind you the customer was using IE6, however we had tested the application onIE6 prior to that and we had not experienced such behaviour. With no way to simulate the problem offsite we had to go onsite. At the client sites it was discovered that their Internet connectivity was behind a corporate proxy. Thanks to the great IE plugin iehttpheaders by Blunk Software we were able to look at the request and responses headers on the browser. Request 1 This is the request after completing the OAuth dance. Notice the OAuth parameters in the Authorzation headers. GET http: //somehost.com/someapp/index?some_value=some_query HTTP/1.0 Accept: application/json, text/javascript, */* Accept-Language: en-us Referer: http://somehost.com/test.html Authorization: OAuth realm="http://somehost.com/",oauth_consumer_key="key", oauth_token="0ca1a675c6bb4ae394069b3e240b6197",oauth_signature_method="HMAC-SHA1",oauth_signature="HgGi6izQbRPnDaoarKkk2itfg4s=", oauth_timestamp="1235464028",oauth_nonce="bzSgtifUd6",oauth_version="1.0" x-requested-with: XMLHttpRequest User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5; .NET CLR 2.0.50727) Host: somehost.com Proxy-Connection: Keep-Alive
HTTP/1.1 407 Proxy Authentication Required Proxy-Authenticate: NTLM Proxy-Authenticate: BASIC realm="Bobo Domain Username and Password" Cache-Control: no-cache Pragma: no-cache Content-Type: text/html; charset=utf-8 Proxy-Connection: close Set-Cookie: BCSI-CS-863E59BB9B98BEDA=2; Path=/ Connection: close Content-Length: 813
GET http: //somehost.com/someapp/index?some_value=some_query HTTP/1.0 Accept: application/json, text/javascript, */* Accept-Language: en-us Referer: http://somehost.com/test.html Cookie: BCSI-CS-863E59BB9B98BEDA=2; __utmc=65970999; x-requested-with: XMLHttpRequest Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAFASgKAAAADy== User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5; .NET CLR 2.0.50727) Host: somehost.com Proxy-Connection: Keep-Alive
HTTP/1.1 407 Proxy Authentication Required Proxy-Authenticate: NTLM TlRMTVNTUAACAAAACAAIADgAAAAFgomimskXX4CIQeAAAAAAAAAAAIYAhgBAAAAABQLODgAAAA9LAFIARgB UAAIACABLAFIARgBUAAEAGgBLAEYAVABBAFUAQgBVAFIAUABYAFIAMAAxAAQAEABLAFIARgBUAC4ATgBlAHQA AwAsAGsAZgB0AGEAdQBiAHUAcgBwAHgAcgAwADEALgBLAFIARgBUAC4ATgBlAHQABQAQAEsAUgBGAFQALgB OAGUAdAAAAAAA Cache-Control: no-cache Pragma: no-cache Content-Type: text/html; charset=utf-8 Proxy-Connection: Keep-Alive Set-Cookie: BCSI-CS-863E59BB9B98BEDA=2; Path=/ Connection: Keep-Alive Content-Length: 830
The initial request is made again however now without the Authorization heder. GET http: //somehost.com/someapp/index?some_value=some_query HTTP/1.0 Accept: application/json, text/javascript, */* Accept-Language: en-us Referer: http://somehost.com/test.html Cookie: BCSI-CS-863E59BB9B98BEDA=2; __utmc=65970999; x-requested-with: XMLHttpReques Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAGYAAAAYABgAfgAAAAgACABIAAAADgAOAFAAAAAIAAgAXgAAAAAAAACWAAAA BYKIogUBKAoAAAAPawByAGYAdABrAGEAcAB2AHgAbQAwAEsAWQBBAFAAWV5DPMLLAQwAAAAAAAAAAAAAA AAAAAAAmZQUP+OrhQJTr8sGO5WtLNI7QyxHr8li User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5; .NET CLR 2.0.50727) Host: somehost.com Proxy-Connection: Keep-Alive Response 3 And it fails. HTTP/1.1 403 Request type not available Date: Tue, 24 Feb 2009 08:27:06 GMT Server: Someserver Vary: Accept-Encoding,User-Agent Content-Type: application/x-json Content-length: 63 Proxy-Connection: Keep-Alive Connection: Keep-Alive Summary This type of behavior is odd for couple of reasons
This type of bizzare behaviour makes it even more critical that service providers ensure that all parameter transmission methods are implemented. |