Coder Social home page Coder Social logo

Comments (4)

fukamachi avatar fukamachi commented on July 16, 2024

Thank you for reporting!

It seems Dex doesn't read the response body at all if the request is HEAD.
https://github.com/fukamachi/dexador/blob/master/src/backend/usocket.lisp#L580

I'll try to fix it when I have time.

from dexador.

fukamachi avatar fukamachi commented on July 16, 2024

Could you show me the HTTP request/response of HEAD?
I'm in trouble with reproducing it.

from dexador.

glv2 avatar glv2 commented on July 16, 2024

Here is a HTTP stream obtained with a function similar to the one described above:

HEAD /json_rpc HTTP/1.1
User-Agent: Dexador/0.9.10 (SBCL 1.3.19); Linux; 4.11.7-gentoo
Host: 127.0.0.1:18081
Accept: */*


HTTP/1.1 401 Unauthorized
Server: Epee-based
Content-Length: 98
Content-Type: text/html
Last-Modified: Tue, 04 Jul 2017 11:51:53 GMT
Accept-Ranges: bytes
WWW-authenticate:Digest qop="auth",algorithm=MD5,realm="monero-rpc",nonce="UVRMfOsaU4p9NdS2OJl/9w==",stale=false
WWW-authenticate:Digest qop="auth",algorithm=MD5-sess,realm="monero-rpc",nonce="UVRMfOsaU4p9NdS2OJl/9w==",stale=false

<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>


POST /json_rpc HTTP/1.1
User-Agent: Dexador/0.9.10 (SBCL 1.3.19); Linux; 4.11.7-gentoo
Host: 127.0.0.1:18081
Accept: */*
Content-Type: application/json
Content-Length: 63
Authorization: Digest username="myuser", realm="monero-rpc", nonce="UVRMfOsaU4p9NdS2OJl/9w==", uri="/json_rpc", cnonce="2mxdzsR4sokr155jrrbKwg==", nc=00000001, qop=auth, response="788c7188bfad9b5854a3894a22212bf8", algorithm="MD5"

{"jsonrpc":"2.0","id":633619,"method":"get_info","params":null}


HTTP/1.1 200 Ok
Server: Epee-based
Content-Length: 636
Content-Type: application/json
Last-Modified: Tue, 04 Jul 2017 11:51:53 GMT
Accept-Ranges: bytes

{
  "id": 633619,
  "jsonrpc": "2.0",
  "result": {
    "alt_blocks_count": 0,
    "block_size_limit": 600000,
    "cumulative_difficulty": 2444181338548414,
    "difficulty": 12049878825,
    "grey_peerlist_size": 4640,
    "height": 1346793,
    "incoming_connections_count": 0,
    "outgoing_connections_count": 8,
    "start_time": 1499161595,
    "status": "OK",
    "target": 120,
    "target_height": 1346722,
    "testnet": false,
    "top_block_hash": "e503344592446a3cb31ddf6e8ac96a95e696338f891e51652d472e376e733cd4",
    "tx_count": 1368397,
    "tx_pool_size": 5,
    "white_peerlist_size": 1000
  }
}

Dexador signals a http-request-unauthorized for the POST request (the second request) although the server responded with HTTP/1.1 200 Ok.

If I change the first request to be a POST instead of a HEAD, I get a similar HTTP stream (with a POST instead of a HEAD on the first line of course) but everything works fine (the second POST request returns the JSON answer).

from dexador.

glv2 avatar glv2 commented on July 16, 2024

I just read in https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html that the HTTP server's response to a HEAD request must not contain a body. However in my example the server doesn't behave correctly and puts a HTML body in the response.

Maybe Dexador is very strict on the expected response format and doesn't recover well after the extra data...

from dexador.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.