[go: nahoru, domu]

Use net::HTTP_XXX instead of hardcoded http status code

Change-Id: I4ee86afcdef7ef48e803219b23dd397bb97229f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3671283
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Auto-Submit: Feifei Wang <alexswang@tencent.com>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1008690}
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 3f76d09..1c7a8c4 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -17,6 +17,7 @@
 #include "net/base/net_errors.h"
 #include "net/disk_cache/disk_cache.h"
 #include "net/http/http_response_headers.h"
+#include "net/http/http_status_code.h"
 #include "net/http/http_util.h"
 
 namespace net {
@@ -226,7 +227,7 @@
     return true;
   }
 
-  sparse_entry_ = (headers->response_code() == 206);
+  sparse_entry_ = (headers->response_code() == net::HTTP_PARTIAL_CONTENT);
 
   if (writing_in_progress || sparse_entry_) {
     // |writing_in_progress| means another Transaction is still fetching the
@@ -292,7 +293,7 @@
 }
 
 bool PartialData::ResponseHeadersOK(const HttpResponseHeaders* headers) {
-  if (headers->response_code() == 304) {
+  if (headers->response_code() == net::HTTP_NOT_MODIFIED) {
     if (!byte_range_.IsValid() || truncated_)
       return true;