Back to the video

πŸš€ Space Reviewers πŸ‘Ύ Episode 6

Transcript

By Speaker 1, Sage, Raffaella. From Djangonaut Space 2026. Published July 13, 2025.

Watch the video Markdown version 7,890 words · auto-generated · en

Summary

The reviewers examine a Django change addressing how request host and port are parsed when a reverse proxy such as Nginx supplies `X-Forwarded-Host` and `X-Forwarded-Port`. They work through the intended behavior, including custom ports, separate forwarded headers, and raising an error when the headers and settings conflict; they also inspect the implementation and run relevant tests. Their review catches practical issues to raise on the pull request: an incorrect rebase that leaves stale test files and obscures new tests, missing documentation and version notes, and a potentially unrelated constant, alongside smaller questions about validation and error-message assertions. The presenters emphasize that reviewers with different experience levels can contribute by tracing the change, checking tests and history, and respectfully asking for clarification.

Transcript

Automatically transcribed, so expect mistakes in names and technical terms. Filler words are removed.

0:00 Space Reviewers and the Ticket

Speaker 1

Go ahead and get started. So hi everyone, we're space reviewers and I'm Lolian. And do you guys want to introduce yourself?

Sage

Yeah, I'm Sage.

Raffaella

I'm Raffaella.

Speaker 1

And yeah, the point of space review viewers is to show you that When we do a peer review, you know, we all come from different levels of experiences, but we can all contribute something. So Yeah, it doesn't really matter our level of experience. We all have something, some kind of insight, some kind of viewpoint. So, how is this going to work? We're going to pick a PR. We've already picked it out. And I'll share the link with you soon. And then we'll dive into it and walk through it And odds. Yeah, sure, our review. So we wanted to do this to show you that everyone could do a review and we'll show you our thought process and how we stepped through it.

And also be respectful. We follow the Django Not Space Code of Conduct. Okay. So we have the link to the PR. To we have the link to the show notes. here so you can follow that along and yeah and I'll go to the notes here So here are the notes. And Raffaella, would you like to give a summary of the ticket since you wrote the notes?

Raffaella

Yes. Okay, this secret is was open because when you have some settings inside the header of your of your proxy for example nginx is going to not to be see the port the host if you have sorry if you have the host inside your header is not going to evaluate the port, so it's going to be not aware of the port. And this is the problem they have going to sol solve it. There's at least

one try with the first PR that was made by the sorry D G C G H and then there were lots of different approaches the also the last one was not the last one the previous one was made by Apollo considering another approach for the for the West for the for the other is that

completely enough

Speaker 1

Yeah, that's good. Sage, do you have anything to add to that?

Sage

Yeah. Well, not really. So this was new you previous PR and I think There was no activity for some period of time, so someone else picked it up. And but yeah, I'm I'm just curious how We are going to review or test this, whether we are going to set up a Django project with an Nginx setup or Yeah, because it's it's quite I don't think it can be tested like just with a plain Django run server. So yeah, I'm not sure what the plan is, but it'll be interesting to see.

4:24 PR History and Header Behavior

Speaker 1

Okay. All right. I'm let's see, let's go ahead and pull down the code. So I already have it pulled down and so I'm on that PR right now. And So I think it's I guess let's look at the most recent PR first and see what files were changed and then let's compare it to the one that Apollo did and then we could kind of go from there. So for here, I think we could see like most of the files, they're the tests. And if we just like skim through it, we see

They're making small changes. This one looks like it's like making adjustments to the test that just to make those tests work. And similar for here, I think these were changes, so it was adding in the allowed hosts. Since I oh maybe I should actually start from this comment that was made. This one is actually I'll I'll say this is a kind of a hard one to follow because there were a lot of PRs. But you know, you just kind of step through it one by one. And I think if

okay, let me back up a bit more. So let's start with The first PR, I believe that that's this one. So yeah, that's the first PR right here. So let's go here and then just skim do the comments. I wanted to go down to the one where they were talking about. Okay, so this is this is a comment that was talking about the logic for how these variables should be used in the precedents. So like Raffaella mentioned, When you're using the use x forwarded host variable and when it's set to true, then you want to make sure that

Use exported okay you want to make sure that when you have use exported host is true and use exported port is false then the settings in the Nginx server should include the server port. And then if you have the case where use exported host is true and use exported port is true. Then it doesn't need to use it doesn't need to let's see. Oh why is this

Sage

Yeah, I think so in Ngin X you can set the header when you set up the proxy from like the front facing server to Django and You can retain the information of the host and port by setting these headers. And Django supports these headers by those settings, like use X for what it host and a ex forwarded port. So when you only set the X forwarded host to be true but the forwarded port is not used, then I guess this is the case where people

just use that one header and combine both the host and the port in that header directly. But there are other cases where people Instead split the host and port into separate headers, so X forwarded host and X forwarded port So the expected engine X configuration when you have both settings in Django set to true is that you also set the headers separately. The host use its own header and the port is also with its own header. But yeah, there might be cases of misconfiguration where people set both Django settings to true, but they used the first

Example of Ngin X configuration where they concatenate the host and port into a single X formulate host header in which case because if Django does not handle that, it might end up appending the port twice. Right. So we want so i in this case Marius is suggesting that Django should raise an exception if that's the case like if it encounters a port in the header forwarded host but the x forwarded port setting is set to I think that that's my understanding.

I'm not sure if I if I get that right.

Speaker 1

That helps a lot. That makes it clear for me at least. Yeah, and then he gave links to the these variables in Django. So those are in the documentation and it explains how they should be used and the precedence in there as well. And then there's more mm And then there is mention of like updating the documentation. to reflect the changes for these variables and the logic here.

And let's see. I'll go ahead and jump back. That's I wanted to make sure that we captured that logic here. And then let's jump back to this PR here. So if we look, if we take a look at the changes here. So there's a change to The regular expression that's being used to parse the settings from the server. And that includes The port year, and then And then

this is where the bulk of the logic is parsing that server line. And here it's checking to make sure that that logic is implemented as it was described

Raffaella

Lillian, could I could I ask you something?

Speaker 1

Yeah.

Raffaella

On YouTube there Thibaut that asked if is there a cookie cutter quick way to set up engines and Django to try this out.

Speaker 1

I don't know. Do you know Sage?

Sage

Sorry, just wanted to make sure. So that YouTube comment is asking a question whether there is a cookie color template. Or are they letting us know that there is a template that we can use?

Raffaella

No, it it's it's a question.

Sage

It's a question, okay. I'm not aware if there is a such a template. I mean there probably is because it's quite a common config. But I guess We so yeah we could either try to look for a template that helps us test the changes, but I wonder if we could get away with just crafting the request with the appropriate headers. And see what happens.

Speaker 1

Yeah, I was gonna go with just doing it in the tests too.

Sage

Yeah.

Speaker 1

Especially since they've written the test here.

Sage

Yeah.

13:12 Testing the Changes

Speaker 1

So Should we go ahead and just run the test that they have?

Sage

I guess we could start with that.

Speaker 1

All right, so I am on this PR and there are one, two, three, four files of tests. One thing I want to point out is that this request test is it looks like it's a brand new file, but it's actually not. There's a previous commit that removed the file because it was conflicting with the requests request module, the request library, and so they renamed it to request test. So a lot of this should be in here. And it makes it a little bit difficult

to track what the changes are, but we'll see. All right, so I can run I'll start with that one and then just to make sure that it at least passed. And then we'll go to request test and then that one passed as well and then I'll come back to the request Oops, site. Yes. That one passed. And then I saved the request folder last because it's not going to pass.

Okay, so it's this is what I described earlier where it's conflicting. And so there was actually a change. So what I'm going to do is just rename this so that we can run it or to something different and then we'll run it and then we'll see So this actually failed, and the reason I believe is There's this test with a different encoding. So it uses encode Latin one. And I'm actually not sure if this is allowed

according. Oh, actually it's not allowed. And it was actually fixed in the other tests. And I'll show you. If you do a little bit of digging on track, you'll see There was a commit. I'm gonna go back here take it. So this is raising an error. Charge it should be ignored for the application. And this is actually corresponding to this error right here. And

so if we take a look here And the changes that were happening in there, they were happening in the request file. It made some changes into there And also into the tests and we were let's see. So we saw it was billing on Tests alternate post. I think that's a new oh okay so that's right here. That's that's the old test

and then it was renamed And it was updated. Yeah, so that's that's one thing where this PR needs to be rebased. So I just wanted to clear that up and so that's one thing. So if I go into there and I go ahead and Remove this. I think we should be okay because we're not concerned about this. This is not related. It was already fixed in the other PR. And I'll run it again and then There are a couple of more problems. I'm just trying to work through all the problems so that we can get to the tests that we that are important.

Sage

I think we could improve the fail output by so if you try to install a package called tblib, yes that one yeah, because sometimes when we run the tests in parallel and there are exceptions.

Speaker 1

Oops. Let me see. I was

Sage

Oh, yeah, you see you fee.

Speaker 1

Okay, and then

Sage

Okay, I can't.

Speaker 1

Okay, so that's the one that we saw earlier. And we know that it's been fixed in one of the commits, so we don't need to worry about it. And then this one. String has string object has no attribute read. It looks like so it happens the task exists in both of these And are

Sage

so are those two files meant to be merged and like it merged into a single one?

Speaker 1

Yeah.

Sage

Okay.

Speaker 1

I wasn't sure how to go about this other than like trying to comment out the ones working And so I'm gonna go ahead and comment that one up since we saw it was passing in the other one and then this one Okay, similar. This one looks like it's been rewritten. So I'll comment this one out as well. And then and then I guess it should all past now and so the tests that remain not all of them are new

but I did do like a I just went in manually looked inside of them to pull out which ones were not which ones were new and most of them started with this string here so test get port with exported host that one was new so maybe we can take a look and make sure that it's testing the new implementation. Yeah, if I'm going down the wrong path, just you know me to do something different.

Sage

I think that's sensible but I guess just to make sure we could take a look at the original a PR from Florian Apollo 13 just to see the tests in requests the tests yeah, so it seems there are some new lines in okay, so that's the test that was added, yes, and then Oh

Speaker 1

that's the same one.

Sage

Yeah.

Speaker 1

There's that one.

Sage

And then there's also some changes to test get port, I think.

Speaker 1

Yeah, most of so those are adding server names to them. I'm I'm going to separate it out. So there are tests that had minor changes and then tests with like that were new. Have it

Sage

text.

Speaker 1

And then so I think this one was added. And I can get rid of it from here. And these were the ones with changes. And this one is just a change. Oh, it's the same one.

Sage

I think there might be so do we also need to include the ones that just added the server name? I think there were a few

Raffaella

get part with the ex forwarded part

Speaker 1

oh good one i missed that one

Sage

Okay. Good.

Speaker 1

Okay, I think we got demo And

Sage

all right.

23:17 Reviewing Port Tests

Speaker 1

So should we start with one of these and then Run it and see or how should I go about this?

Sage

Yeah, I think we could try, I mean We have already run the whole test module, right? So oh but if you mean like going through the lines, yeah, I think like the test code instead of just running the test Right, okay, yeah, I think I think we can do that.

Speaker 1

All right. So this one test get port with exported host. Okay, it looks like it has the server name and the port in this variable. And so that should be supported and it seems like it's checking If this is using the exported host header Okay, and so they've set up

the metadata, the meta variable to have These other values and they're checking to make sure that this get port will return the correct port number.

Sage

Yeah, so the first part tests so I think like the server name and server port that's like the standard meta request information and then if the request includes the X forwarded host header and then the setting is set to use that header, then Django should take that into account and use the word from the exforwarded host header instead, which in this case that's the thing because the actual so server port that Django receives is 8080 but the header from XForded

host uses 8000 And so we expect that if you use the export worded host setting, then that should be used instead. So that should be A But if a request comes in and it doesn't have the ex forwarded host, I suppose in this case the expected behavior is for Django too. use the default surfer port information instead of I don't know maybe failing if it doesn't find the X forward host. I mean I think this that's that sounds like a sensible test.

Speaker 1

Alright.

Sage

What do you think?

Raffaella

I have a I have a question. Inside the ticket I saw that the example port they used is 8443 yes over there. I don't let me know if that's correct. It's not a default port because the usual default port it's the 443 Is it correct?

Sage

yeah, so

Raffaella

it is

Sage

Like HTTPS port is usually four three.

Raffaella

Okay.

Sage

And in this case it's so engine s engine X is listening on some custom port in this case as an example 8443 Because I think the issue was Yeah, so the issue is that So usually it's pretty normal to not include the port if the scheme is HTTPS and the port is 443 because that's the default. default port or in the case of HTTP it's AT. So yeah, the original ticket is talking about let's say you use HTTPS and the port

is some custom port not 443 in this case 8443 and apparently Django just ignores it so yeah that that's the issue sorry just does that answer your question

Raffaella

No because I saw inside the engine's settings that sometimes they suggest to use this type of port But it's not actually the default board for HTTPS. Is that correct?

Sage

Yeah, because HTTPS the default port for HTTPS is 443 without the eight at the front. So I think with Nginx, I'm I'm not entirely sure. Because you know you can technically just run the server on any port you like and I guess in this case Wait, are you saying that Nginx suggests using 8443 instead?

Raffaella

Yes, I saw I saw inside here yes I posted in the in the chat. Oh yeah, yeah, yeah. Over there. I

Sage

Okay.

Raffaella

Maybe is do you think it's going to happen to have the age for three port as a default port? In the future maybe.

Sage

Oh. Oh, yeah, I just realized. Yeah, that's that's a good point. I didn't re I didn't know that. Apparently, it's commonly used as an alternative port for HTTPS. But yeah I'm not sure how Th does web does the web browser automatically know if you just type the address. I think I think it's probably just because

you know 443 is the default port and you might have some other application running. at that port. So yeah.

Raffaella

So you have the true application on HTTPS. So you have the okay.

Sage

You have to run them on different ports and like a common alternative for to four three is eight four three. But I don't think if you type https sum server dot com for example I don't think the browser will attempt to connect to 8443. It will always try to connect to 443, I think. So it's it's just some sort of I I'm not sure if you can call it convention. I guess it's just a common alternative for it. But yeah, I honestly I'm not a hundred percent sure on this. So yeah.

Raffaella

Yeah, I found out just in just when I was watching the ticket. So I mm I would I became curious because I know that the default part was the 443 but I was I don't understand if maybe in the future it could be also H 443 and another default port. Who maybe I don't know. But now yes, it it's it's the it's a custom port. Thank you, thank you, Sage.

Speaker 1

Good observation All right, let's see. So we were going to do that test. Are we going down the right path, like going down each one of those tests?

32:22 Rebase and Documentation Issues

Sage

So I think the problem with the new PR is It wasn't rebased in a way that was correct. I mean because we still see the requests tests. File in the requests directory when it should have been moved. So if we go to the new br ideally we should only see the requests underscore tests directory instead of both of them. So yeah, I'm not sure Yes,

I guess that's one of the main points that we can point out in the review comments. Like could you every base maybe every base well Yeah, it's it I g we just need to at least point out that this file has moved so we shouldn't have this file in the PR

Speaker 1

Okay, so that's one thing, and Oh, and then another thing I want to point out is they haven't added any documentation.

Sage

Right.

Speaker 1

And so we'd like to see documentation. Documentation. Do we need to specify which files they should be updating?

Sage

If we want to be extra helpful, I guess that that would be nice.

Speaker 1

It would be, I think it would just be these. This request response.

Sage

Yeah, so I think that and maybe also the Settings documentation for the use X for what it port and yeah this one.

Speaker 1

Okay. Do I need two point okay so that one docs Add documentations for settings. txt and I forget request response Okay, yeah, dot TXT. And then

Did we find out so I commented this out and Was that a test that they added? So okay, so for this one, I was wondering what

Raffaella

No.

Speaker 1

When I ran it failed on my end.

Sage

I think it's it might be because this is the old test before it was changed in the PR that this allowed this encoding for form in URL encoded thing And the reason why we are seeing this as an added file is because it the rebase was done incorrectly. So we are seeing this as an addition. even though this test isn't related to the PR at all. So yeah, Okay. Yeah. Oh

Speaker 1

I'll just add a note. Make sure to remove or is the rebase just enough?

Sage

It depends how they do the rebase, I think, because yeah they have already rebased at the point where the PR move the test so as you can see in the PR if we go to the new requests underscore tests the py file. So yeah, we can see that the new tests have been added to this file instead. So they should have just well actually no. So when they so as you can see the these only include changes where

the changes were Added well like it only changed the existing tests, but we don't see any new test cases in here. So the I guess this is just me assuming what happened during the re the rebase. So I think git correctly handles like it f it can follow the rename of the test file and hence we see these changes to the existing tests. But in cases where the original PR added some new lines for the new tests, Git will ask you like do you want to keep this file

because in Django's main it's been removed. And then this person who made the new VR just accepted the whole test module instead of picking just the new tests and move them over to the new file. So that's what they should have done. But yeah, instead they just accepted the whole test file and this results in like the old tests that are now in the new file is re-added in this old requests test. py file and us as reviewers can't easily see like

which tests are new so yeah I I'm not sure how to word that into like a review comment, but yeah, so make sure that the requests tests. py file is removed but the added test should be incorporated to the new file. Yeah. So I guess make sure to incorporate the new tests into the new

yeah the new test into yes that file instead I guess we need to point out that yes, exactly Yeah, I think that works.

Speaker 1

Okay. Oh, I have another one documentation and version change and I just picked that up from one of the comments from a previous one of the comments.

Sage

Yeah

Speaker 1

Let's see

41:04 Port Handling Test Cases

Sage

So the does the original PR sorry, I forgot I think you have a list of new tests that were added? Yeah, so I think we can just look at those and instead of like the whole thing because some of the other tests are just tests that have been there forever and they're unrelated to the VR.

Speaker 1

Okay.

Sage

Yes.

Speaker 1

All right, so get host with use export and http host. Okay, so this is the case where you have the separate the lines. Exported port header.

We'll take a look. If I'm understanding this correctly, it should well mm It should be using this value if it's present and then this value.

Sage

I'm not sure if that comment is correct. in the test like it says should not use the ex forwarded host but it does use it

Speaker 1

Is it saying the HTTP exported variable?

Sage

Oh.

Speaker 1

Versus the

Sage

I guess. Yeah, I think the comment should have said should not use the exported host header because the setting that's set to false is the host one but the port one is set to through so it should combine so it should use the host from http host but the port from x forwarded port I think so the test itself is correct, like the assertions are correct, but the comment is not a thing.

Speaker 1

Should I see ya

Sage

Oh yeah, yeah.

Speaker 1

Okay.

Sage

I think we can just use the suggestion feature of that Yeah. So I think that should be host.

Speaker 1

variable?

It's

Sage

Well I mean we could probably just change the to keep the original comment but change the word port to host because yeah we 're Yeah. So instead of port, yeah, it's it should say host, yeah.

Speaker 1

I'm kind of con

Sage

Oh yeah. So that variable is like so Django transforms the header into the http underscore thing in the request meta. It's up to you, I guess, if whether you want to work the comment in terms of Django request meta attributes or in terms of the header names

Speaker 1

Oh, okay, I see, I see. I'll leave it.

Sage

Yeah, I just thought just to avoid making I mean because the original PR already used the terms in terms of the header names so just to reduced the amount of changes, I guess.

Speaker 1

Okay. So there's that one and then I guess there's this one

Sage

Sorry, what's the test just before this? I just want to make sure just Okay. Do we need to be concerned about this?

Speaker 1

did

Sage

anything change in this? I think yeah

Speaker 1

It was just the server names.

Sage

Okay. All right.

Speaker 1

So this is the opposite of the other one?

Sage

Yeah, I guess you can see that.

Raffaella

Yeah, the note is not included now. Should use the forward port.

Speaker 1

I guess it looks good. Right. So we'll go to the next one. So this is with IPv6. So they're using the IPv6 address. And they're just making sure that it can parse correctly. Okay. Oh so they're checking that this will convert into a number.

Sage

No, it's it's it's in the X forward. Yeah, that one.

Speaker 1

Oh, I see, I see. Okay. All right. I think that's similar to the other one. It's the IPM.

Sage

Yeah, exactly. I think so.

Speaker 1

And then this one get port with exported host and port. So we're expecting it to use these two. All right, so these two settings are set to true here. And it's checking that it's using that and this.

Raffaella

Is this a case that Felix was talking about

Sage

Not yet. I think That will be it might be the next one. Oh, that's the one after this. Yes. Yeah, that's

Speaker 1

Okay, so this one has the host with the port and then it defines the port again a second time.

Sage

Yes.

Speaker 1

And I forget which one it should take.

Sage

It should raise an error.

Speaker 1

Oh, okay.

Raffaella

Okay.

Speaker 1

And so it raises the error.

Sage

Yeah, I think we might be able to add a refew comments saying that I think usually Django uses assert racist message to also assert the error message. So not just the ever type

Speaker 1

should i go ahead and add that or just someone else wants to add it rafaella do you want to add that

Raffaella

So I don't understand Mm

Sage

they

Raffaella

are going to Yeah, he's going to raise an arrow and

Sage

Yes

Raffaella

It's not what we expect. I think the yet

Sage

It's just j Django usually If it's an error message that is racist by us as in by Django and not like say Python. We tend to use assert races message instead of assert races so that we also ensure that the error message is a certain string that we added in the implementation. So I guess what we can do here is we check the implementation code where the error is raised. Yeah, so something like that.

Speaker 1

And I haven't looked into what that message would be.

Sage

Yeah, we'll we'll we'll need to look into it

Speaker 1

I was just wondering like if someone else wants to add a comment.

Sage

Yeah, sure. I can add that. Yeah, maybe add that to the notes and then I'll add that at the end of the review.

Speaker 1

Use cert raises message instead of So it raises in this test. All right. And so we gone to

Raffaella

Lilian if you want if because I'm I'm the in the same line I can suggest the or it or do you want to make a message a long message or is maybe I can use a suggestion

Speaker 1

you can you can make it

54:46 Implementation Review Questions

Speaker 1

There was one comment that I saw about this function here, parse host. It was asking to validate the value that was being parsed to make sure that it's a number. Did any of you see this one?

Sage

I guess it makes sense. Did so I think Florian said that they would push the Changes with those. Okay

Speaker 1

I don't think he ended up pushing it because it never came in and I don't see it here. So I was just wondering if maybe we could resurface that and ask them

Sage

about if

Speaker 1

they should validate the value that's being split.

Sage

Yeah, I think it's worth a comment just asking whether it's something we need to consider. Just to make sure it doesn't get lost in between the transition.

Speaker 1

Okay. All right. What else should we check? Should we go to how do you feel about the review so far?

Sage

I think it's going good. I probably look at the code from top to bottom, just in case. Okay, so just changing some imports. That still looks good to me so far. That I'm not sure about that. Why is there an a max allowed file? I don't think we're dealing with files, so I'm not sure why that's there.

Speaker 1

Interesting. Let's see if they had it in here. It wasn't in here and I wonder if it's in Maine. Mean okay, let me just check if it's their requests. Okay, right. Okay, I have yeah, they don't have me neither. Is it being used anywhere?

Sage

That's a good question.

Speaker 1

Okay, it's down here.

Sage

I don't know why that's there. Maybe they were working on an unrelated ticket. Let me see if I can find a ticket. A ticket about maximum files.

Raffaella

Sage how are you going to find out if a ticket has this constant?

Sage

It might not be that constant, so I'm just using Google to find like with keywords, for example, Django maximum files upload. And I make sure to only include results from code. jangoproject. com. I'm not sure if I'm able to find it though.

Yeah, I cannot find that specifically There is a somewhat related ticket, but it's already fixed from five years ago, so probably not that. Nine years ago actually. But yeah, I don't think that's related to what we're doing at all. So yeah, I guess we could just ask. Is that related to this PR? Related to the TKID, I guess.

Speaker 1

That's a good catch. And okay, so another thing I noticed is that the previous one used lazy Regular compile. And then this one doesn't? Wasn't sure.

Sage

I guess you could check what the main branch is doing. And yeah, if it has lazy compile then we should keep that Yeah.

Speaker 1

Why was this removed?

Sage

I think I mean I think the answer is it was lost during the rebate So

Speaker 1

oh okay. It it's interesting though because it wasn't

Sage

oh that's good

Speaker 1

it wasn't here but It probably was lost at some point.

Sage

Yeah. What about the very first PR Okay, yeah, then I think it's a good question to ask, like why is that removed? So maybe it wasn't a big base issue

Speaker 1

Okay. Let's see. And then they used They added a name tubble and I know Adam Johnson put in a comment about name tubbles. I wasn't sure. He says needy comes are weird. You suggested using something else?

Raffaella

Oh, do you mean the first PR?

Speaker 1

Yeah, so this

Sage

it's the second PR. Oh

Raffaella

this is this

Speaker 1

And then also it's like from five years ago, so I don't know if it still applies.

Sage

Yeah, I'm not sure how it I guess yeah we can just leave a comment saying do we should we change this to something else? Per comment from Adam? Should we consider, I guess, consider

I think

Speaker 1

they got rid of this function.

Raffaella

Oh mm. There's there's an idea to keep get row host but the Apollo said that he preferred to have a function to have the same behavior in the previous PR was a comment

I think yeah, right there. Isn't this Yeah.

Speaker 1

Okay, so it's pretty much just rewriting this function.

1:07:13 Walking Through the Implementation

Speaker 1

Were there any test cases that we have not considered?

Sage

That's a good question. I'm not sure. So

Speaker 1

if we look at this logic again , Didn't we look at the tests? Maybe we can get back to that after the rebate.

Sage

Yeah, I think

Speaker 1

it'll be easier to follow. Is there anything you see in here?

Sage

So I guess at first Yeah, it checks whether so I guess the X forwarded host header is only considered if the use exported host setting is true. And it does that and it has a variable that tracks whether the overdot host contains a port or not which I think is sensible. And yeah, if use export with a host setting is not set to true, it's just going to look in the HTTP host meta

which sounds reasonable and otherwise yeah if it cannot find the http host It does the logic ice which I assume might be in the original implementation in Rowhost maybe? The one that was deleted Yeah, so I guess that's the I wonder if so if you click on the Cockwheel icon button at the top of the PR yes and then click hide white space

I wonder if this gives us a better view of the oh yeah, okay. Yeah, I guess some of the lines are not changed okay. Yeah, so the first if use forwarded toast and Yeah, so that that bit is new and then the if HTTP host in well actually that's that's still the same as the deleted one, but instead of using settings.

directly we use a variable for use for what the public host import. So yeah, I guess the change here is that we use the parse host header function instead of just reading the HTTP host, which makes sense. I guess that's where it tries to parse the port from the host. And that Yeah, and then it adds the bit where it detects

that you're using use X forward port set thing but and then it also finds the Wait. Yeah. So the use X forwarded port setting is true and then there's the X forwarded port header, but the X forwarded host also contains the port then that's improperly configured and that's the error message that we want to test Yeah, I think that makes sense.

And I guess it caches the result. in the parsed host object attributes so that yeah if you already called the method before it It's just going to return the result instead of recalculating the whole thing again I see

It it's mostly the same but because of the added indentation. Or I guess because we now parse the host thing to ensure that the port is separated if it includes one. Yeah, now we make use of the parsed host object thing. But I think the rest of the logic is the same I think so

Speaker 1

Where is this validate coming from?

Sage

Just

Speaker 1

a nitpick up. I feel like it's

Sage

maybe the method now accepts Oh. I mean I think if we look at the method of this new method, does it have

Speaker 1

Oh, okay. I must have missed it.

Sage

Yeah, okay.

Speaker 1

Is I don't know, maybe this is nitpicking, but Validate is like a verb? Should it be more is valid or something or

Sage

I think it's because where the parameter dictates whether this method should also validate the host. By validate, I think it's going to check against the allowed host.

Speaker 1

okay

Sage

yeah so yeah it will call the validate host function only if validate is true so that's why it's called validate So

Speaker 1

there's a new get host method and it uses that parse host header and then it returns the combined. So that was from the tuple.

Sage

Right. I think the getHouse method is not new, but yeah, because Git doesn't really understand what happens. Yeah, so there is at the bottom. So if you scroll down a bit, there it is. There removed lines, a few lines above this one. Yeah.

Speaker 1

Okay.

Sage

So yeah. Mostly move to the get parse h host header thing because now get port also relies into checking whether the port exists in the in the in the host. So that's why they share a base implementation Mm that might be a new method

Yeah, that's the suspicious thing.

Speaker 1

And we we've touched on that split to main port, and so

Sage

I'm not entirely sure why this has changed.

Speaker 1

Let's see what's in the

Sage

oh. Yeah, let's see what's what it says in the original PR maybe. No comments

Do

Speaker 1

we have anything to say about this one?

Sage

I'm trying to think. Port. I guess I don't really have anything to say but maybe there yeah, I'm not sure I'm not exactly sure what changed here maybe there is additional handling if the port is not in the

like it has the port equals port or empty string, which is not in the original implementation. So I guess that's That's probably although the original code also has so it does match. groups default Str empty string. So I guess the different thing is it originally uses full match and now it just uses Re dot match. which I'm not sure of what the difference is but I guess that's the main one of the main changes.

But yeah, I don't know what to add there. I think we can leave it as is.

Speaker 1

Okay.

Sage

Oh, that's nice. So yeah, that debug thing because they moved the implementation of that to the HTTP request object its itself. Yeah. Why I said it's nice is that I because I think there have been cases where I really need that implementation where it includes the scheme and the host basically like the absolute URL and previously it's only available in this debug thing But they've moved it to the HTTP

request. Yeah, it's just refactoring.

Speaker 1

And then these are the tests which we've gone through. Let's see. This is mainly adding in the headers. To make it work. I think making sure that it's valid.

Sage

All right.

Speaker 1

This is hard to look at again.

Sage

Yeah.

Speaker 1

Should we just go to the next one?

Sage

I think so.

Speaker 1

Okay, and then this is just adjusting it to make sure it will work.

Sage

Yeah, I guess that was because it now validates against the allowed host.

Speaker 1

And is this trying to make sure it gets a new instance?

Sage

Yeah, I think so.

Speaker 1

Otherwise it has like stale data carried over.

Sage

Yeah, it has the cache parsed object thing.

1:23:15 Preparing Review Comments

Speaker 1

Okay, we're at the end. So we have some comments. Do you two want to go through them and add them to the PR?

Sage

Yeah, shall we split them?

Speaker 1

Yeah. Just call out him

Sage

So Rafi, did you say that you were going to add the assert racist message thing?

Raffaella

Okay, I think I already did.

Sage

Okay. Let's see.

Raffaella

Let's see. Oh

Sage

Yeah, f feel free to pick ones that you want to comment and I'll I'll I'll take the whatever le w whatever is left.

Speaker 1

Okay. Yeah, Rafi, just call out which one you want to claim.

Raffaella

Okay, I'm going to have the max allowed files because it was really interesting to understand why I think it's not made on purpose.

Speaker 1

Okay.

Raffaella

Or maybe or maybe if it's on purpose we don't understand why. It could be interesting to understand.

Speaker 1

I'll take the ones with the links so it's easy to put

Sage

them in.

Speaker 1

And then we have this one, this one, and this one. So Sage , do you want to take those?

Sage

Yeah, sure, sure.

Speaker 1

I can I can copy and paste this into our Discord.

Sage

Oh that that would be nice. Yes, please.

Raffaella

No, thank you.

Sage

Thank you.

Speaker 1

Okay. And we're gonna count down, right?

Sage

Yeah, but let me write the comment first, because I haven't Okay, one second.

Okay. I've done one comment. I have two more, I think. What's the cat? Okay. Then documentation

Explored house What One second. Sorry, it's taking me a while to write the comments.

Okay. Maybe a bonus comment about the refactoring. It should probably be a separate commit. I know this is This change was from the previous PR, but before we merged this Should probably be sub right commit. Okay, I'm ready.

Speaker 1

Okay, I guess well let me see I need to scroll up. All right Oh, I forgot it.

Sage

let

Speaker 1

me see. Okay, I think that's

Sage

Maybe sh maybe we should say thanks for working on it. Yes.

Speaker 1

I give one

Sage

eight.

Speaker 1

Yeah okay. Are you ready?

Sage

Yep.

Raffaella

Yes. Yes.

Speaker 1

One two? Three screen. Very cool.

Sage

All right, nice.

Speaker 1

I think I don't see yours yet. I don't see yours, Popola.

Sage

I can't see yours either.

Raffaella

I s I can see yours.

Sage

Have you submitted the review? Is it still like pending maybe?

Raffaella

Oh yes, isn't pending? Which one is it pending Oh yeah. Why is it impending?

Sage

So if it's impending you need to click the green button at the top right in the files change yes that button

Raffaella

Okay. Oh and here we are. I have to submit a view at your comment

Speaker 1

Okay, we see you now.

Raffaella

Oh thank you

Speaker 1

Very cool. All right. Well, I think that's it. We'll wrap up and we did it. We reviewed a PR.

Sage

Yay.

Speaker 1

Thank you everyone for watching. So glad that people came. Yeah, so hopefully we can do another one maybe sometime soon.

Sage

Yeah, this was fun. Thanks for organizing this.

Speaker 1

Yeah, I mean it's so cool to be able to work with other people and learn instead of like trying to figure it out on my own.

Sage

Yeah, definitely.

Speaker 1

All right. Oh sounds good