Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use size_t to store content length.
  • Loading branch information
joelreymont committed Oct 31, 2012
commit 3079bdae66d116e61ff19c5d856cf6e05bf83db4
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
auto it = headers.find("Content-Length");
if (it != headers.end()) {
try {
content_length_ = std::stoi(it->second);
content_length_ = std::stoul(it->second);
NETWORK_MESSAGE("Content-Length: " << *content_length_);
} catch(const std::invalid_argument&) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest a NETWORK_MESSAGE here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What line number is here exactly? There's a NETWORK_MESSAGE printing the content length, for example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside the catch, print out that you got an invalid content length value.

} catch(const std::out_of_range&) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are referring to a message on exception. Fair enough, will add.

Expand Down Expand Up @@ -825,7 +825,7 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
boost::promise<boost::uint16_t> status_promise;
boost::promise<std::string> status_message_promise;
boost::promise<std::multimap<std::string, std::string> > headers_promise;
boost::optional<unsigned> content_length_;
boost::optional<size_t> content_length_;
boost::promise<std::string> source_promise;
boost::promise<std::string> destination_promise;
boost::promise<std::string> body_promise;
Expand Down