# Http Server: Stuck in "Extract URL Path". Working in my local

**URL:** <https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641>\
**Category:** Challenges\
**Tags:** challenge:http-server\
**Created:** [May 17, 2025, 4:19am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641 "2025-05-17T04:19:53Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 4:19am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/1 "2025-05-17T04:19:53Z")

</div>

I’m stuck on Stage #(IH0).

I’ve tried .. using both PrintWrite and Buffered Reader to print the output and it is working fine in my local.

Here are my logs in local:

```auto
curl -v http://localhost:4221/mango
* Host localhost:4221 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:4221...
* Connected to localhost (::1) port 4221
> GET /mango HTTP/1.1
> Host: localhost:4221
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 404 Not Found
< 
* no chunk, no close, no size. Assume close to signal end

* Closing connection

```

And here’s a snippet of my code:

```java
System.out.println("Logs from your program will appear here!");

		// Uncomment this block to pass the first stage

		try {
			ServerSocket serverSocket = new ServerSocket(4221);

			// Since the tester restarts your program quite often, setting SO_REUSEADDR
			// ensures that we don't run into 'Address already in use' errors
			serverSocket.setReuseAddress(true);

			// Wait for connection from client.
			// serverSocket.accept();

			var clientSocket = serverSocket.accept();
			BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
// BufferedWriter out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
			PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);

			String requestLine = in.readLine();

			String[] requestParts = requestLine.split(" ");

			String pathParams = requestParts[1];

			String httpResponse;
			if (pathParams.equals("/") || pathParams.isBlank()) {
				httpResponse = "HTTP/1.1 200 OK\r\n\r\n";
			} else {
				httpResponse = "HTTP/1.1 404 Not Found\r\n\r\n";
			}

			out.println(httpResponse);
// out.flush();
			clientSocket.close();

			System.out.println("Response Message has been sent back to the client");
		} catch (IOException e) {
			System.out.println("IOException: " + e.getMessage());
		}

```

It is showing Tests Failed and it is unable to pick the new code in the codecrafters UI.

```auto
[tester::#IH0] Running tests for Stage #IH0 (Extract URL path)
[tester::#IH0] $ ./your_program.sh
[your_program] Logs from your program will appear here!
[tester::#IH0] $ curl -v http://localhost:4221/mango
[your_program] Modified message has been sent to the client
[tester::#IH0] Expected status code 404, got 200
[tester::#IH0] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

```

Github link: [GitHub - Vaibhav-Somani/codecrafters-http-server-java: Learning 101](https://github.com/Vaibhav-Somani/codecrafters-http-server-java)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 4:21am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/3 "2025-05-17T04:21:14Z")

</div>

Hey @Vaibhav-Somani, could you [upload your code to GitHub](https://docs.codecrafters.io/features/publish-to-github) and share the link? It will be much easier to debug if I can run it directly.

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 4:35am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/4 "2025-05-17T04:35:08Z")

</div>

Hello @andy1li  
Here it is: [GitHub - Vaibhav-Somani/codecrafters-http-server-java: Learning 101](https://github.com/Vaibhav-Somani/codecrafters-http-server-java)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 7:56am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/6 "2025-05-17T07:56:29Z")

</div>

@Vaibhav-Somani, I ran your code on our tester and it worked fine. Could you try running it again and let me know if the issue persists?

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 12:56pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/9 "2025-05-17T12:56:01Z")

</div>

Hello @andy1li It is not working. Looks like it is not even picking up the new code. It is showing tests failed in the UI with following logs. The log statement at the end has been updated from past few commits. I even modified the debug to be true in the yml file but even that is not working. Following are the failure logs:

````auto
[compile] [INFO] 
[compile] [INFO] --------------< io.codecrafters:codecrafters-http-server >--------------
[compile] [INFO] Building codecrafters-http-server 1.0
[compile] [INFO] from pom.xml
[compile] [INFO] --------------------------------[jar]---------------------------------
[compile] [INFO] 
[compile] [INFO] --- resources:3.3.1:resources (default-resources) @ codecrafters-http-server ---
[compile] [INFO] skip non existing resourceDirectory /app/src/main/resources
[compile] [INFO] 
[compile] [INFO] --- compiler:3.13.0:compile (default-compile) @ codecrafters-http-server ---
[compile] [INFO] Recompiling the module because of changed source code.
[compile] [INFO] Compiling 1 source file with javac [debug target 23] to target/classes
[compile] [INFO] 
[compile] [INFO] --- resources:3.3.1:testResources (default-testResources) @ codecrafters-http-server ---
[compile] [INFO] skip non existing resourceDirectory /app/src/test/resources
[compile] [INFO] 
[compile] [INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ codecrafters-http-server ---
[compile] [INFO] No sources to compile
[compile] [INFO] 
[compile] [INFO] --- surefire:3.2.5:test (default-test) @ codecrafters-http-server ---
[compile] [INFO] No tests to run.
[compile] [INFO] 
[compile] [INFO] --- jar:3.4.1:jar (default-jar) @ codecrafters-http-server ---
[compile] [INFO] Building jar: /app/target/codecrafters-http-server-1.0.jar
[compile] [INFO] 
[compile] [INFO] --- assembly:3.7.1:single (make-assembly) @ codecrafters-http-server ---
[compile] [INFO] Building jar: /tmp/codecrafters-build-http-server-java/codecrafters-http-server.jar
[compile] [WARNING] Configuration option 'appendAssemblyId' is set to false.
[compile] Instead of attaching the assembly file: /tmp/codecrafters-build-http-server-java/codecrafters-http-server.jar, it will become the file for main project artifact.
[compile] NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!
[compile] [WARNING] Replacing pre-existing project main-artifact file: /app/target/codecrafters-http-server-1.0.jar
[compile] with assembly file: /tmp/codecrafters-build-http-server-java/codecrafters-http-server.jar
[compile] [INFO] ------------------------------------------------------------------------
[compile] [INFO] BUILD SUCCESS
[compile] [INFO] ------------------------------------------------------------------------
[compile] [INFO] Total time: 2.739 s
[compile] [INFO] Finished at: 2025-05-16T18:10:49Z
[compile] [INFO] ------------------------------------------------------------------------
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.
[tester::#IH0] Running tests for Stage #IH0 (Extract URL path)
[tester::#IH0] $ ./your_program.sh
[your_program] Logs from your program will appear here!
[tester::#IH0] $ curl -v http://localhost:4221/mango
[your_program] Modified message has been sent to the client
[tester::#IH0] Expected status code 404, got 200
[tester::#IH0] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)```
````

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 1:05pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/10 "2025-05-17T13:05:29Z")

</div>

@Vaibhav-Somani Do you by any chance have another account? We didn’t see any submissions in the last 19 hours under **Vaibhav-Somani**.

Mind sharing the username at the top right of the page so that I can take a closer look for you?

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/f/f9ef951e4f29de409812379b6e332a2063fe1865.png)

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 1:19pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/11 "2025-05-17T13:19:38Z")

</div>

> [@Vaibhav-Somani](#):
>
> debug

@andy1li My username is Vaibhav-Somani. I am committing code since past 12-14 hours. Not sure how it is not getting updated. Adding screenshots of my git commits.  
Git commit link: [Commits · Vaibhav-Somani/codecrafters-http-server-java · GitHub](https://github.com/Vaibhav-Somani/codecrafters-http-server-java/commits/master/)

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/c/ca89ee4d497ef56c6c99aeb88018aabfd35083cf.png)  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/b/b95f2227be712df1a03e3238f11d61a2611ed041.png)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 1:23pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/12 "2025-05-17T13:23:49Z")

</div>

That does seem quite unusual.

Could you run `git remote -v` and share the result?

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 1:31pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/13 "2025-05-17T13:31:05Z")

</div>

@andy1li

Following are the results along with screenshot:

```git
[redacted by Andy]

```

Edited by Andy:

Redacted since other people can push to it as well.

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 1:40pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/15 "2025-05-17T13:40:56Z")

</div>

Sorry @andy1li  
I did not understand the issue. Can you explain it in detail along with the solution?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 1:41pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/16 "2025-05-17T13:41:15Z")

</div>

@Vaibhav-Somani Looking into it now.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 1:44pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/17 "2025-05-17T13:44:21Z")

</div>

Well, only the first two stages of the HTTP server challenge are free. You’ll need a membership to run tests against later stages:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/a/a3c10c7b37c2a6cf59d62f1549429f8d28398090.png)

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 2:14pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/18 "2025-05-17T14:14:03Z")

</div>

@andy1li  
But I can still work on other challenges, right? My tests will show a failure in the UI. I should still be able to test them by running the server in local and hit the API.  
Please correct me if my understanding is wrong.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 2:21pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/19 "2025-05-17T14:21:40Z")

</div>

> But I can still work on other challenges, right?

Yep, feel free to explore our free challenges and the first two free stages in other challenges.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/7/74021603ebf2f4f8844af3698cc92fa1c22b0b67.png)

> My tests will show a failure in the UI.

Sorry for the confusion. The error you’re seeing is from a previous submission (about 20 hours ago). Your recent pushes didn’t trigger a new submission since the current stage requires a membership.

Let me know if anything’s still unclear!

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 2:24pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/20 "2025-05-17T14:24:51Z")

</div>

@andy1li  
It is still unclear. I should be able to explore challenges that are not free and run them in my local, right? It will not show as passed in the UI, but I will be able to go through them and learn from them.  
I hope my question is clear. Please let me know if you need any further clarifications.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 17, 2025, 2:32pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/21 "2025-05-17T14:32:29Z")

</div>

> I should be able to explore challenges that are not free and run them in my local, right? It will not show as passed in the UI, but I will be able to go through them and learn from them.

Yes, you can absolutely continue building locally.

Just note that without a membership, you won’t be able to run tests on our servers for the member-only stages.

---

<div class="post-metadata">

**Author:** ![Vaibhav-Somani](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/vaibhav-somani/32/11232_2.png) [@Vaibhav-Somani](https://forum.codecrafters.io/u/Vaibhav-Somani)\
**Post date:** [May 17, 2025, 2:34pm UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/22 "2025-05-17T14:34:29Z")

</div>

Understood. Thanks @andy1li  
Please feel free to close the thread.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [May 25, 2025, 7:26am UTC](https://forum.codecrafters.io/t/http-server-stuck-in-extract-url-path-working-in-my-local/10641/23 "2025-05-25T07:26:03Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
