Skip to content

Added proxy_handler, modified request#36

Open
konradjniemiec-zz wants to merge 17 commits intoUCLA-CS130:masterfrom
konradjniemiec-zz:proxy_handler
Open

Added proxy_handler, modified request#36
konradjniemiec-zz wants to merge 17 commits intoUCLA-CS130:masterfrom
konradjniemiec-zz:proxy_handler

Conversation

@konradjniemiec-zz
Copy link

Starting to implement proxy_handler, added skeleton code. Still need to be able to parse response. Will continue proxy_handler on this branch.

@konradjniemiec-zz
Copy link
Author

Proxy Request currently hang. Host header needs to be changed and HttpVersion is wrong. Need to be fixed in ProcessRequest before calling PerformRequest.

@konradjniemiec-zz
Copy link
Author

Can anyone take a look at this? It still hangs and I have no idea why even though I hardcoded a correct request. It says "Reading" And then hangs on the read.

@sgervais21
Copy link
Contributor

@konradjniemiec Are you asking us to look at this? Or your team members?

@konradjniemiec-zz
Copy link
Author

@sgervais21 my team members. If you want to build this branch and take a shot at it too it would be appreciated as well haha

@mjchen04
Copy link
Contributor

mjchen04 commented Mar 6, 2017

Hey, has there been any progress on the proxy handler code? This pull request has not been updated for almost a week now.

@konradjniemiec-zz
Copy link
Author

@mjchen04 @valeedmalik We are waiting for the professors to respond to us, we are stuck on what we think is a bug in boost.

@konradjniemiec-zz
Copy link
Author

Has been fixed now. Only need integration tests and dependency injection.

@mjchen04
Copy link
Contributor

mjchen04 commented Mar 8, 2017

Hey guys. Added some preliminary and nit picky style change requests. Can you also apply the same to other files that I didn't comment on yet?

Also, is the bulk of the functionality finished now and ready for code review?

@konradjniemiec-zz
Copy link
Author

@mjchen04 yes, just have unit tests I'm finishing now.

@konradjniemiec-zz
Copy link
Author

@mjchen04 I also don't know what style changes you are talking about, so I can't really add them.

@mjchen04
Copy link
Contributor

mjchen04 commented Mar 8, 2017

@konradjniemiec and team members. Are you able to see the comments I added to files?

@konradjniemiec-zz
Copy link
Author

@mjchen04 I don't think we are able to see your comments, where would we be able to see them?

#include "proxy_handler.h"
#include "config_parser.h"
#include <boost/asio.hpp>
RequestHandler::Status ProxyHandler::Init(const std::string& uri_prefix,
Copy link
Contributor

Choose a reason for hiding this comment

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

Space before Init declaration

Copy link
Author

Choose a reason for hiding this comment

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

What do you mean here? Line after the include?

proxy_handler.cc Outdated
#include "config_parser.h"
#include <boost/asio.hpp>
RequestHandler::Status ProxyHandler::Init(const std::string& uri_prefix,
const NginxConfig& config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Idk if this is just the way github displays or not. But can you try to line up const on line 5 to line 4

proxy_handler.cc Outdated
}

RequestHandler::Status ProxyHandler::HandleRequest(const Request& request,
Response* response)
Copy link
Contributor

Choose a reason for hiding this comment

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

Line up Response with const

}

RequestHandler::Status ProxyHandler::PerformRequest(Request& request,
Response* response,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same line up of parameters

proxy_handler.cc Outdated
const std::string& host_port) {
try {
boost::system::error_code ec;
boost::asio::io_service io_service;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix indentation

echo "Sending requests"

# Send request to server
curl -s www.ucla.edu:80 > temp_expected
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for temp_expected and temp_response as temp_config

response.cc Outdated

std::string Response::ToString() {
std::string response_msg = "HTTP/1.1 " + to_string(status);
std::string response_msg = version+" "+ status;
Copy link
Contributor

Choose a reason for hiding this comment

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

Include spaces between operands and operators

response.h Outdated
bad_request = 400,
not_found = 404
};
static std::unique_ptr<Response> Parse(const std::string& raw_response)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move the implementation to .cc

proxy_handler.cc Outdated
boost::system::error_code ec;
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver(io_service);
boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve({host_uri,host_port},ec);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove extra space between iterator and endpoint..

@@ -0,0 +1,58 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this doing the same thing as proxy_redirect.sh?

Copy link
Author

Choose a reason for hiding this comment

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

changed so that they do different things

@mjchen04
Copy link
Contributor

See if you can see them now.

@konradjniemiec-zz
Copy link
Author

@mjchen04 Got most of them, put my refutation for others, sorry for being late with it was sick all weekend. Let me know if there is anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants