azutoolkit / duo

A Pure HTTP 2 Server for the Crystal Language with full support for H2Load and H2Spec test coverage
MIT License
80 stars 4 forks source link

Error: undefined constant Stream::State::Idle #2

Open Dan-Do opened 2 years ago

Dan-Do commented 2 years ago

When compiling the client

client.request(headers) do |headers, body|
             ^------
Error: instantiating 'Duo::Client#request(HTTP::Headers)'

In lib/duo/src/duo/client.cr:57:36

 57 | stream = @connection.streams.create
                                   ^-----
Error: instantiating 'Duo::Streams#create()'

In lib/duo/src/duo/streams.cr:47:24

 47 | def create(state = Stream::State::Idle)
                         ^------------------
Error: undefined constant Stream::State::Idle
Dan-Do commented 2 years ago

After changing to Duo::State::Idle, it compiled ok. But there is exeption:

Unhandled exception:  (Duo::Error)
  from /home/ali33/lib/duo/src/duo/connection.cr:217:9 in 'read_frame_header'
  from /home/ali33/lib/duo/src/duo/connection.cr:62:7 in 'call'
  from /home/ali33/lib/duo/src/duo/client.cr:33:7 in 'initialize'
  from /home/ali33/lib/duo/src/duo/client.cr:10:5 in 'new'

Is the client usable when connecting to other host other than localhost?

Dan-Do commented 2 years ago

I manually changed the max_frame_size value, then it can connect to the server. But the server responded with message HTTP/1.1 400 Bad Request\r\nDate: Tue, 30 Nov 2021 09:11:31 GMT\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: 166\r\nConnection: close\r\n\r\n<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>400 Bad Request</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n

eliasjpr commented 2 years ago

@Dan-Do thanks for reporting this. Let me know if you have a fix for this if yes feel free to create a PR

eliasjpr commented 9 months ago

Allow me a few days to look into this issue.

Dan-Do commented 9 months ago

@Dan-Do thanks for reporting this. Let me know if you have a fix for this if yes feel free to create a PR

No, I tried but no solutions works. Now I have to move to libcurl.