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

add http handlers for CORS, metrics and compression #27

Closed
wants to merge 1 commit into from

Conversation

ns4plabs
Copy link
Contributor

Depends on #23

@ns4plabs ns4plabs marked this pull request as draft January 11, 2024 20:12
@codecov-commenter
Copy link

Codecov Report

Attention: 190 lines in your changes are missing coverage. Please review.

Comparison is base (0d72338) 0.00% compared to head (2469a47) 21.76%.

Files Patch % Lines
server_routers.go 56.35% 98 Missing and 5 partials ⚠️
server.go 0.00% 46 Missing ⚠️
server_dht.go 0.00% 41 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main      #27       +/-   ##
=========================================
+ Coverage      0   21.76%   +21.76%     
=========================================
  Files         0        5        +5     
  Lines         0      611      +611     
=========================================
+ Hits          0      133      +133     
- Misses        0      473      +473     
- Partials      0        5        +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lidel lidel requested a review from hacdias January 11, 2024 20:22
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for cleaning this up @ns4plabs, removes need for CORS on reverse proxy + JSON routing return is highly compressible due to repeating strings. ❤️

nit: I think this PR includes changes from #23, we probably need to land that one first (iirc blocked by review?), and then rebase this one.

Let's discuss #23 next week.

server.go Show resolved Hide resolved
@hacdias hacdias changed the base branch from main to parallel January 14, 2024 20:26
}).Handler(handler)

// Add compression.
compress, err := httpcompression.DefaultAdapter()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: check if this handler adds extra buffering.
If this happen this would be bad since we would be forced to wait before using any of the response.

I think it could be possible that a writer would need to first fill it's window buffer before streaming out bytes. We can compress each entry individually and concatenate them if this ever happens (decompress(compress(a + b)) == decompress(compress(a) + compress(b)) for gzip and zstd).

@hacdias hacdias deleted the branch ipfs:parallel January 15, 2024 15:59
@hacdias hacdias closed this Jan 15, 2024
@Jorropo
Copy link

Jorropo commented Jan 15, 2024

@hacdias I think it auto closed and you didn't meant to do it.

(should have been a stack on graphite 😄)

@hacdias
Copy link
Member

hacdias commented Jan 15, 2024

Oh, yeah, it autoclosed. GitHub usually just changes the base branch automatically. No idea how this happened.

@hacdias
Copy link
Member

hacdias commented Jan 15, 2024

@ns4plabs would you mind making a new rebased PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants