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

ssl doent work with stream:t set #126

Closed
nightshade427 opened this issue Feb 26, 2015 · 15 comments
Closed

ssl doent work with stream:t set #126

nightshade427 opened this issue Feb 26, 2015 · 15 comments

Comments

@nightshade427
Copy link
Contributor

When setting stream to "t" when calling tcp-ssl-connect cl-async fails. This is used in libraries likedrakma-async.

@orthecreedence
Copy link
Owner

Should be fixed in 939644c =]

@nightshade427
Copy link
Contributor Author

I get HTTP connection timeout: -1: HTTP stream client timed out. when proxying several ssl resources at the same time. I dont get this error when proxying lots of non-ssl resources.

@orthecreedence
Copy link
Owner

Is your proxy terminating SSL and requesting HTTP resources? Or is it terminating SSL then requesting other SSL resources?

@nightshade427
Copy link
Contributor Author

It is non ssl to ssl:

http-app.js => wookie => carrier/drakma => https-app.js on another server

@nightshade427
Copy link
Contributor Author

Actually this seems to happen on non ssl too under load.

Proxing a webpage that has serveral assets (css, images, js, etc) on it, and repeatedly hitting refresh shows timeouts.

@nightshade427
Copy link
Contributor Author

It errors with the above HTTP connection timeout: -1: HTTP stream client timed out. with drakma. With carrier it seems as though the the error just gets absorbed and doesnt surface but it never completets.

Its as though there is a lower level cl-async error and its triggering http-connection timeout error in drakma, and in carrier its just ignoring the error and silently bombing on it?

I will try and dig further to see what the error might be.

@nightshade427
Copy link
Contributor Author

Okay I found a case that repos it every time. Going to try and see why its erroring.

@nightshade427
Copy link
Contributor Author

It seems as though the finish-request callback isnt being called. Its like fast-http reads the data fine each time, but never triggers the finshed callback, fast-http does process the headers and start processing the body though, but never finishes.

This times out (finish callback never called, but it reads the headers and starts to read the body)(You may have to try it a couple times to get it to repo):

(as:with-event-loop (:catch-app-errors t)                                                                      
           (bb:catcher                                                                                                  
            (bb:multiple-promise-bind (body status headers) (das:http-request "https://www.firma8.com/assets/bg.png")   
              (format t "~&status: ~s~&headers: ~s" status headers))                                                    
            (t (e) (format t "error: ~a" e))))

This hangs forever:

(as:with-event-loop (:catch-app-errors t)                                                                                                                                
           (bb:catcher                                                                                                                                                            
            (bb:multiple-promise-bind (body status headers) (carrier:request "https://www.firma8.com/assets/bg.png" :return-body t)                                               
              (format t "~&status: ~s~&headers: ~s" status headers))                                                                                                              
            (t (e) (format t "error: ~a" e))))

This doesnt have any issue:

(as:with-event-loop (:catch-app-errors t)                                                                      
           (bb:catcher                                                                                                  
            (bb:multiple-promise-bind (body status headers) (drakma:http-request "https://www.firma8.com/assets/bg.png")   
              (format t "~&status: ~s~&headers: ~s" status headers))                                                    
            (t (e) (format t "error: ~a" e))))

@nightshade427
Copy link
Contributor Author

Let me know if you need anything else to help repo the issue.

Its like the stream stops getting data from the server somehow?

@nightshade427
Copy link
Contributor Author

Okay I got ssl disabled for the site above.
This works:

(as:with-event-loop (:catch-app-errors t)                                                                      
           (bb:catcher                                                                                                  
            (bb:multiple-promise-bind (body status headers) (das:http-request "http://www.firma8.com/assets/bg.png")    
              (format t "~&status: ~s~&headers: ~s" status headers))                                                    
            (t (e) (format t "error: ~a" e))))

This does not:

(as:with-event-loop (:catch-app-errors t)                                                                      
           (bb:catcher                                                                                                  
            (bb:multiple-promise-bind (body status headers) (das:http-request "https://www.firma8.com/assets/bg.png")    
              (format t "~&status: ~s~&headers: ~s" status headers))                                                    
            (t (e) (format t "error: ~a" e))))

The only difference is the ssl. I think it has something to do with ssl-run-state, its like it isnt seeing new data from the socket.

@nightshade427
Copy link
Contributor Author

It also only seems to effect files of 32k or larger? When I do png's over ssl that are smaller than that they work.

@nightshade427
Copy link
Contributor Author

Found and fixed once I saw ones under 32K worked. The size of the ssl response chunks are 16k, and the code currently called ssl-run-state twice, so if the size was larger it was never called again and data was left hanging in the stream.

Making pull request now for the fix. Will link to here for context.

@orthecreedence
Copy link
Owner

Thanks a ton for taking a look at this. Sorry I've been MIA the past week or so, had a lot of busy days/nights. Have you found this works for all larger file sizes?

@nightshade427
Copy link
Contributor Author

All the large ones I've tried so far :)

@orthecreedence
Copy link
Owner

Perfect, thanks!

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