OLD | NEW |
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 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 | 5 |
6 #include "nacl_io/mount_node_http.h" | 6 #include "nacl_io/mount_node_http.h" |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include <string.h> | 11 #include <string.h> |
12 | 12 |
13 #include <ppapi/c/pp_errors.h> | 13 #include <ppapi/c/pp_errors.h> |
14 | 14 |
15 #include "nacl_io/mount_http.h" | 15 #include "nacl_io/mount_http.h" |
16 #include "nacl_io/osinttypes.h" | 16 #include "nacl_io/osinttypes.h" |
17 | 17 |
18 #if defined(WIN32) | 18 #if defined(WIN32) |
19 #define snprintf _snprintf | 19 #define snprintf _snprintf |
20 #endif | 20 #endif |
21 | 21 |
| 22 namespace nacl_io { |
| 23 |
22 namespace { | 24 namespace { |
23 | 25 |
24 // If we're attempting to read a partial request, but the server returns a full | 26 // If we're attempting to read a partial request, but the server returns a full |
25 // request, we need to read all of the data up to the start of our partial | 27 // request, we need to read all of the data up to the start of our partial |
26 // request into a dummy buffer. This is the maximum size of that buffer. | 28 // request into a dummy buffer. This is the maximum size of that buffer. |
27 const size_t MAX_READ_BUFFER_SIZE = 64 * 1024; | 29 const size_t MAX_READ_BUFFER_SIZE = 64 * 1024; |
28 const int32_t STATUSCODE_OK = 200; | 30 const int32_t STATUSCODE_OK = 200; |
29 const int32_t STATUSCODE_PARTIAL_CONTENT = 206; | 31 const int32_t STATUSCODE_PARTIAL_CONTENT = 206; |
30 const int32_t STATUSCODE_FORBIDDEN = 403; | 32 const int32_t STATUSCODE_FORBIDDEN = 403; |
31 const int32_t STATUSCODE_NOT_FOUND = 404; | 33 const int32_t STATUSCODE_NOT_FOUND = 404; |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 534 |
533 assert(bytes_read <= bytes_to_read); | 535 assert(bytes_read <= bytes_to_read); |
534 bytes_to_read -= bytes_read; | 536 bytes_to_read -= bytes_read; |
535 out_buffer += bytes_read; | 537 out_buffer += bytes_read; |
536 } | 538 } |
537 | 539 |
538 *out_bytes = count; | 540 *out_bytes = count; |
539 return 0; | 541 return 0; |
540 } | 542 } |
541 | 543 |
| 544 } // namespace nacl_io |
| 545 |
OLD | NEW |