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

Request don't work with httpie but well with curl #347

Closed
cmoulliard opened this issue Apr 30, 2015 · 3 comments
Closed

Request don't work with httpie but well with curl #347

cmoulliard opened this issue Apr 30, 2015 · 3 comments

Comments

@cmoulliard
Copy link

I have a strange issue where a curl REST request works very well and not when using httpie

  • CURL - http 200
curl -v -i http://admin:admin@localhost:8181/hawtio/jolokia/list
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8181 (#0)
* Server auth using Basic with user 'admin'
> GET /hawtio/jolokia/list HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.37.1
> Host: localhost:8181
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
  • HTTPIE - http 403
dabou:~$ http --pretty=all --verbose --debug GET http://admin:admin@localhost:8181/hawtio/jolokia/list
HTTPie 0.9.2
HTTPie data: /Users/chmoulli/.httpie
Requests 2.6.2
Pygments 2.0.2
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] darwin

>>> requests.request({'allow_redirects': False,
 'auth': <httpie.plugins.builtin.HTTPBasicAuth object at 0x1009fe950>,
 'cert': None,
 'data': OrderedDict(),
 'files': DataDict(),
 'headers': {'User-Agent': 'HTTPie/0.9.2'},
 'method': u'get',
 'params': ParamsDict(),
 'proxies': {},
 'stream': True,
 'timeout': 30,
 'url': u'http://admin:admin@localhost:8181/hawtio/jolokia/list',
 'verify': True})

GET /hawtio/jolokia/list HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic YWRtaW46YWRtaW4=
Connection: keep-alive
Host: localhost:8181
User-Agent: HTTPie/0.9.2

HTTP/1.1 403 Forbidden
Content-Length: 0
Server: Jetty(8.1.16.v20140903)
@cmoulliard
Copy link
Author

Same issue too with version 0.9.2 of httpie

http --pretty=all --verbose http://admin:admin@localhost:8181/hawtio/jolokia/list
GET /hawtio/jolokia/list HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic YWRtaW46YWRtaW4=
Connection: keep-alive
Host: localhost:8181
User-Agent: HTTPie/0.9.2

HTTP/1.1 403 Forbidden
Content-Length: 0
Server: Jetty(8.1.16.v20140903)

or passing user:password with the -a parameter

http --pretty=all --verbose -a admin:admin http://localhost:8181/hawtio/jolokia/list

@cmoulliard
Copy link
Author

That could maybe help, I have intercepted the HTTP packets

curl : https://gist.github.com/cmoulliard/483904cc03514c47f980

http : https://gist.github.com/cmoulliard/3debd03a0399fdad4afc

@cmoulliard
Copy link
Author

Problem is related to a workaround added by the Fuse project supporting hawtio-web/jolokia. With curl the user agent is not authenticated against jaas realm of karaf with a cookie session but basic authentication is used. As this is not the case for httpie, this is why we get a 403 error

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

1 participant