GithubHelp home page GithubHelp logo

Comments (11)

xyzshantaram avatar xyzshantaram commented on June 5, 2024 1

@cmorten -- Here you go! https://github.com/xyzshantaram/opine-content-length-bug

Sorry I couldn't work on it last year ;)

from opine.

xyzshantaram avatar xyzshantaram commented on June 5, 2024

@jeremythille Hi! I've run into the same issue, and I'm wondering if you've found a workaround yet -- this is kind of a deal breaker...

from opine.

jeremythille avatar jeremythille commented on June 5, 2024

@ No, actually I tried to remove Opine altogether and serve my files just with Deno, without a library, and so far it works well

from opine.

cmorten avatar cmorten commented on June 5, 2024

Heya @xyzshantaram, @jeremythille 👋

Do you have a minimal reproduceable example / gist / repo that I can use to try and debug this issue?

from opine.

jeremythille avatar jeremythille commented on June 5, 2024

Ha, no sorry (and it's new year's eve, and then I'm going on a trip so I don't really have time to set up a repo now). But I've put my whole server code in my original question, apart from the Angular files which are really generic HTML/CSS/JS files. Thanks for looking into this issue, and of course, happy new year :)

from opine.

xyzshantaram avatar xyzshantaram commented on June 5, 2024

@jeremythille That will work for a bit, I suppose.
@cmorten I can try to write one for you, it's a bit late where I am but I will try to post it by tomorrow!

from opine.

cmorten avatar cmorten commented on June 5, 2024

Thanks for the great repro @xyzshantaram!

I've identified the issue - with some of the changes moving to the new std/http server for 2.0.0 of opine a regression has been introduced where served files are now being closed before the stream has finished reading them.

Problem code where resources are closed just after the respond call is made in response.ts

I have an idea for a fix which can look into this afternoon 😄

The code has its own reader impl. which was needed originally, and to ensure resource cleanup this close loop was introduced. With the 2.0.0 changes we now use a readable stream for the response which is capable of closing the resource itself- suspect can bin off the hand rolled reader to fix the bug and also get a slight perf benefit 😄

from opine.

cmorten avatar cmorten commented on June 5, 2024

Hey @jeremythille @xyzshantaram I've just released 2.0.2 which I believe fixes the issue. If not please do reopen!

from opine.

jeremythille avatar jeremythille commented on June 5, 2024

from opine.

xyzshantaram avatar xyzshantaram commented on June 5, 2024

Ah, crap, I forgot to respond to this! @cmorten thanks a lot for the prompt fix, it worked perfectly! <3

from opine.

jeremythille avatar jeremythille commented on June 5, 2024

For the record, I still haven't tried @cmorten's fix, because I'm still trying to code a little server using native Deno code (for learning purposes, I want to understand how Deno works before using libraries), and I have the same issue without Opine.

For that matter, I have just opened a similar issue on Deno's repo: denoland/deno#13362

So... is it an Opine, or a Deno issue after all? :)

EDIT

It is a "me" issue! I forgot to encapsulate the inner await in an anonymous function, it works now. Sorry folks.

from opine.

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.