# AP6 Passing and EJ5 failing

**URL:** <https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010>\
**Category:** Challenges\
**Tags:** challenge:http-server\
**Created:** [July 12, 2024, 5:27pm UTC](https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010 "2024-07-12T17:27:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RammohanSharmaGit](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rammohansharmagit/32/933_2.png) [@RammohanSharmaGit](https://forum.codecrafters.io/u/RammohanSharmaGit)\
**Post date:** [July 12, 2024, 5:27pm UTC](https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010/1 "2024-07-12T17:27:36Z")

</div>

I have hardcoded the directory flag as a string instead of taking it as an input and it passes ap6 but somehow fails the EJ5 despite no change to that code.

I saw similar post but in that solution suggested seemed different than my issue.

```auto
[tester::#AP6] Received response with 404 status code

[tester::#AP6] Test passed.

[tester::#AP6] Terminating program

[tester::#AP6] Program terminated successfully

[tester::#EJ5] Running tests for Stage #EJ5 (Concurrent connections)

[tester::#EJ5] Running program

[tester::#EJ5] $ ./your_server.sh

[tester::#EJ5] Creating 2 parallel connections

[tester::#EJ5] Creating connection 1

[tester::#EJ5] Creating connection 2

[tester::#EJ5] Sending first set of requests

[tester::#EJ5] client-2: $ curl -v http://localhost:4221/

[tester::#EJ5] client-2: > GET / HTTP/1.1

[tester::#EJ5] client-2: > Host: localhost:4221

[tester::#EJ5] client-2: >

[tester::#EJ5] client-2: Sent bytes: "GET / HTTP/1.1\r\nHost: localhost:4221\r\n\r\n"

[your_program] accepted new connection

[tester::#EJ5] Failed to read response:

[tester::#EJ5] Received: "" (no content received)

[tester::#EJ5] ^ error

[tester::#EJ5] Error: Expected: HTTP-version, Received: ""

[tester::#EJ5] Test failed

[tester::#EJ5] Terminating program

[tester::#EJ5] Program terminated successfully

```

this is the logs of test.

this is my code portion for ap6

```auto
 String filename = path.split("/")[2];
                String filePathStr = "/tmp/" + filename;
                System.out.println(filePathStr);
                Path filePath = Paths.get("/tmp/data/codecrafters.io/http-server-tester/",filename);
                if(Files.exists(filePath)){
                String fileText = Files.readString(filePath);
                writer.write("HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nContent-Length: " + fileText.length() + "\r\n\r\n" + fileText);
                } else {
                writer.write("HTTP/1.1 404 Not Found\r\n\r\n");
                }

```

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [July 29, 2024, 7:18pm UTC](https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010/2 "2024-07-29T19:18:19Z")

</div>

@RammohanSharmaGit something must’ve changed in the code that handles the earlier stage, maybe there’s some kind of global function or something that changed? Could you paste the full code here?

---

<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:** [October 4, 2024, 2:57am UTC](https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010/3 "2024-10-04T02:57:21Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to start a new discussion!

---

<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:** [October 9, 2024, 2:57am UTC](https://forum.codecrafters.io/t/ap6-passing-and-ej5-failing/1010/4 "2024-10-09T02:57:33Z")

</div>

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