Skip to content

Conversation

@Gekctek
Copy link

@Gekctek Gekctek commented May 28, 2025

Here are the changes that i did in the fork that fixed some issues i was having. Ill comment on them because some should be ignored.
Just doing a draft PR so i can comment on the changes, don't intend to merge

// update the status code to '304 Not Modified'
get_success_endpoint(key_or_alias, encoding, headers_array, is_aliased).status(304);
// update the status code to '304 Not Modified' and remove the body since the content is not sent
get_success_endpoint(key_or_alias, encoding, headers_array, is_aliased).status(304).body("");
Copy link
Author

Choose a reason for hiding this comment

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

@tomijaga I was not able to get cached assets back that were certified because the body was expected to be populated even though it was a 304

};

public func get_html_alias_root(fs : T.FileSystem, alias : Text) : ?Text {
if (not Text.endsWith(alias, #text ".html")) return null;
Copy link
Author

Choose a reason for hiding this comment

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

@tomijaga This an a few other changes were added to TRY to make it so that when i add an asset called index.html, i would be able to get a certified form from /, but instead i would always get the index.html, but certified for the /index.html path, vs the / path
I don't think i was successful, and this is my biggest issue right now
From what i could figure out, if you added a file as /, it would resolve to /index.html, but not the other way around (i could be wrong, but thats what it looks like)

let (status_code, body, opt_body_hash) : (Nat16, Blob, ?Blob) = if (contains_hash) {
(304, "", null);
} else {
let content_chunk : Blob = switch (Encoding.get_chunk(self.fs, encoding, chunk_index)) {
Copy link
Author

Choose a reason for hiding this comment

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

Optimization since 304 didn't need content


public func http_request_streaming_callback(self : T.StableStore, token : T.StreamingToken) : T.Result<T.StreamingCallbackResponse, Text> {
public func http_request_streaming_callback(self : T.StableStore, rawToken : T.StreamingToken) : T.Result<T.StreamingCallbackResponse, Text> {
let ?t : ?T.CustomStreamingToken = from_candid (rawToken) else return #err("http_request_streaming_callback(): Invalid token");
Copy link
Author

Choose a reason for hiding this comment

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

I had changed all the signatures to have the streaming token just a Blob vs that specific data structure

@tomijaga
Copy link
Member

Thanks for these. I'll take a look later and merge the updates.

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

Successfully merging this pull request may close these issues.

2 participants