Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http Request sends wrong HTTP ? #30

Open
ybilik opened this issue Aug 8, 2014 · 2 comments
Open

Http Request sends wrong HTTP ? #30

ybilik opened this issue Aug 8, 2014 · 2 comments

Comments

@ybilik
Copy link

ybilik commented Aug 8, 2014

Hello,

I have done the following tests (with httplibrary 0.4.2). Both should return the same response, but the GET answer is a HTTP status 302 (as expected), while the Http Request answer is 400:

*** Settings ***
Library HttpLibrary.HTTP

*** Test Cases ***
With GET Test
Create Http Context www.facebook.com http
Next Request May Not Succeed
GET /
Log Response Status
Log Response Headers
Log Response Body
Restore Http Context

With Http Request Test
Create Http Context www.facebook.com http
Next Request May Not Succeed
Http Request GET /
Log Response Status
Log Response Headers
Log Response Body
Restore Http Context

I ran into Wireshark to look at the sent requests, and it seems (not sure as I am not familiar with wireshark) that Facebook feels angry because when using the "Http Request" keyword, the Host header is set to localhost:80 instead of www.facebook.com.

I got this bug because originally, I had a problem with https requests: here again, I am not sure, but it seems that the "Http Request" keyword always use the http scheme, even if I set it to https with a call to "Create Http Context".

@vikulin
Copy link

vikulin commented May 8, 2016

I investigated issues related to Http Request.
Conclusion:

  1. Http Request does not send HTTP headers at all.

Actual result:
Following headers are missing:
Date-Iso:Testing Authorization:Testing Userid:[email protected]
Apache log after OPTIONS request by Http Request:
+9819:572ef840:6|OPTIONS /edtest HTTP/1.1|Accept-Encoding:identity|Host:localhost%3a80|Content-Length:0 -9819:572ef840:6
Expected result:
Fixed OPTIONS method

+9820:572ef92b:c|OPTIONS /edtest HTTP/1.1|Accept-Encoding:identity|Date-Iso:Testing|Host:localhost|Authorization:Testing|Userid:[email protected]|Content-Length:0

  1. Affected method is
    https://github.com/peritus/robotframework-httplibrary/blob/master/src/HttpLibrary/__init__.py#L187
  2. There is a workaround:

Fixed method for OPTIONS added into init.py:

def OPTIONS(self, url):
        path = self._path_from_url_or_path(url)
        self.context.pre_process_request()
        logger.debug("Performing OPTIONS request on %s://%s%s" % (
            self.context._scheme, self.app.host, path))
        self.context.post_process_request(
            self.app.options(path, self.context.request_headers)
        )

@vikulin
Copy link

vikulin commented Jun 3, 2016

Any updates here?

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

No branches or pull requests

2 participants