OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "nacl_io/httpfs/http_fs.h" | 5 #include "nacl_io/httpfs/http_fs.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <ctype.h> | 8 #include <ctype.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 23 matching lines...) Expand all Loading... |
34 bool upper = true; | 34 bool upper = true; |
35 for (size_t i = 0; i < s.length(); ++i) { | 35 for (size_t i = 0; i < s.length(); ++i) { |
36 char c = s[i]; | 36 char c = s[i]; |
37 result += upper ? toupper(c) : tolower(c); | 37 result += upper ? toupper(c) : tolower(c); |
38 upper = c == '-'; | 38 upper = c == '-'; |
39 } | 39 } |
40 | 40 |
41 return result; | 41 return result; |
42 } | 42 } |
43 | 43 |
44 Error HttpFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { | 44 Error HttpFs::OpenWithMode(const Path& path, int open_flags, mode_t mode, |
| 45 ScopedNode* out_node) { |
45 out_node->reset(NULL); | 46 out_node->reset(NULL); |
46 | 47 |
47 ScopedNode node = FindExistingNode(path); | 48 ScopedNode node = FindExistingNode(path); |
48 if (node.get() != NULL) { | 49 if (node.get() != NULL) { |
49 *out_node = node; | 50 *out_node = node; |
50 return 0; | 51 return 0; |
51 } | 52 } |
52 | 53 |
53 // If we can't find the node in the cache, create it | 54 // If we can't find the node in the cache, create it |
54 std::string url = MakeUrl(path); | 55 std::string url = MakeUrl(path); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 *out_manifest = text; | 405 *out_manifest = text; |
405 return 0; | 406 return 0; |
406 } | 407 } |
407 | 408 |
408 std::string HttpFs::MakeUrl(const Path& path) { | 409 std::string HttpFs::MakeUrl(const Path& path) { |
409 return url_root_ + | 410 return url_root_ + |
410 (path.IsAbsolute() ? path.Range(1, path.Size()) : path.Join()); | 411 (path.IsAbsolute() ? path.Range(1, path.Size()) : path.Join()); |
411 } | 412 } |
412 | 413 |
413 } // namespace nacl_io | 414 } // namespace nacl_io |
OLD | NEW |