Skip to content

Commit

Permalink
[NaCl SDK] Refactor STATUSCODE_*
Browse files Browse the repository at this point in the history
Move "STATUSCODE_OK, STATUSCODE_PARTIAL_CONTENT, STATUSCODE_FORBIDDEN,
STATUSCODE_NOT_FOUND, STATUSCODE_REQUESTED_RANGE_NOT_SATISFIABLE' from
http_fs_node.cc to http_status_codes.h to share the codes with the
future functionalities exposed to nacl_io.

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_nacl_sdk;master.tryserver.chromium.mac:mac_nacl_sdk;master.tryserver.chromium.win:win_nacl_sdk

Review-Url: https://codereview.chromium.org/2518593002
Cr-Commit-Position: refs/heads/master@{#433413}
  • Loading branch information
chanpatorikku authored and Commit bot committed Nov 19, 2016
1 parent d2d3910 commit 1001cfa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
18 changes: 18 additions & 0 deletions native_client_sdk/src/libraries/nacl_io/http_status_codes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LIBRARIES_NACL_IO_HTTP_STATUS_CODES_H_
#define LIBRARIES_NACL_IO_HTTP_STATUS_CODES_H_

namespace nacl_io {

const int32_t STATUSCODE_OK = 200;
const int32_t STATUSCODE_PARTIAL_CONTENT = 206;
const int32_t STATUSCODE_FORBIDDEN = 403;
const int32_t STATUSCODE_NOT_FOUND = 404;
const int32_t STATUSCODE_REQUESTED_RANGE_NOT_SATISFIABLE = 416;

} // namespace nacl_io

#endif // LIBRARIES_NACL_IO_HTTP_STATUS_CODES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <ppapi/c/pp_errors.h>

#include "nacl_io/httpfs/http_fs.h"
#include "nacl_io/http_status_codes.h"
#include "nacl_io/kernel_handle.h"
#include "nacl_io/osinttypes.h"

Expand All @@ -27,11 +28,6 @@ namespace {
// request, we need to read all of the data up to the start of our partial
// request into a dummy buffer. This is the maximum size of that buffer.
const int MAX_READ_BUFFER_SIZE = 64 * 1024;
const int32_t STATUSCODE_OK = 200;
const int32_t STATUSCODE_PARTIAL_CONTENT = 206;
const int32_t STATUSCODE_FORBIDDEN = 403;
const int32_t STATUSCODE_NOT_FOUND = 404;
const int32_t STATUSCODE_REQUESTED_RANGE_NOT_SATISFIABLE = 416;

StringMap_t ParseHeaders(const char* headers, int32_t headers_length) {
enum State {
Expand Down
1 change: 1 addition & 0 deletions native_client_sdk/src/libraries/nacl_io/library.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"html5fs/html5_fs_node.h",
"httpfs/http_fs.h",
"httpfs/http_fs_node.h",
"http_status_codes.h",
"inode_pool.h",
"ioctl.h",
"jsfs/js_fs.h",
Expand Down

0 comments on commit 1001cfa

Please sign in to comment.