Questions tagged [indexes]

indexes() is a function with CS50's mostly-implemented server.c program in PSET6. It must check, in order, whether index.php or index.html exists inside of path. It returns to path to match if so, else it returns NULL.

Filter by
Sorted by
Tagged with
1
vote
1answer
220 views

server.c indexes - what is to be done?

This is silly, I did the parsing engine, the locate, straight forward. However, I have no idea what I am supposed to do for indexes. Yes, I read the instructions but they make no sense. "that the ...
1
vote
1answer
101 views

Pset6: Errors with Check50

When I use check50 to check my parse function, I find that check50 fails multiple tests and that the terminal generates multiple errors. I am using strtok to separate the request line into different ...
1
vote
2answers
158 views

PSET6 Indexes Doesn't Work

Regardless of what I do, I can't seem to get the indexes function working. It always seems to return null. char* indexes(const char* path) { char* inPHP = malloc(sizeof(char) * strlen(path) + 11); ...
1
vote
1answer
71 views

Pset6 Server works fine for cat.jpg, but fails check50

I've implemented load and indexes and the website seems to work ok. I say ok because it prints out hello, hello, world when I access hello.php, and fails pretty much all the checks in the second ...
1
vote
1answer
534 views

Images Not Loading in Server.c, but Getting 200 OK Response

I've been grinding on this pset6 problem for days. I've implemented all four functions thus far. After I had only implemented lookup and parse, I passed the server1 check50 so I assume both of those ...
0
votes
2answers
530 views

Pset6 problem in indexes and load function

Check 50 returns a lot of errors https://sandbox.cs50.net/checks/caefd03d8ac2485b820743724297b846 Edit: New check50 https://sandbox.cs50.net/checks/fa32659c01b742b78c18f1568d48b90d My load function ...
0
votes
1answer
82 views

error in load and indexes function

I can't seem to find a problem in my load and indexes function. I need help asap. PS- my lookup and parse functions show all green ticks on check50 char* indexes(const char* path) { // TODO ...
0
votes
1answer
41 views

Pset6 Indexes Server.c - Segmentation Fault

My program compiles correctly, but when I use check50, I get multiple errors. I believe there is a segmentation fault in indexes because all of the check50 tests return 0. Does the segmentation fault ...
0
votes
1answer
26 views

indexes function in server.c

I was wondering about the indexes function for server.c. I am currently trying to implement it. As per the specs, I have to enable my program to find out if a file named index.html or index.php exists ...
0
votes
1answer
82 views

Need help with load function pset6

Just after completing Parse i've stucked on load function. By cs50 check i definately understand that something is wrong in reading memory to a buffer and maybe even accsessing it. For my eyes this ...
0
votes
1answer
58 views

Pset6: load() and indexes() fail check50 server2 (but parse() and lookup() pass check50 server1)

Have been going around in circles for days over Pset6. Pretty confident my lookup and parse functions are correct (and they pass check50 server1), but it's all gone very wrong with load and indexes. ...
0
votes
1answer
41 views

pset6 server2 /dir/ malloc [SOLVED]

I can access perfectly to directories, but check50 doesn't agree: $ check50 2015.fall.pset6.server2 server.c :) server.c exists :) server compiles :) Requesting cat.jpg returns 200, image/jpeg, and ...
0
votes
1answer
31 views

How/when to free this memory? (pset6/server)

Here is my implementation of the indexes function in pset6: char* indexes(const char* path) { char* php = "index.php"; char* html = "index.html"; char* pathCopy = malloc(strlen(path) + ...
0
votes
1answer
74 views

check50 fails on pset6 possibly indexes function

I am having problems while running check50 2015.fall.pset6.server2 server.c The thing is that all echecks are correct except these 2: :( Requesting /test/ outputs /test/index.html \ expected ...
0
votes
1answer
169 views

Pset6: How to debug load() and indexes()?

Every time comes the debugging part with the GDB, I feel quite lost. To a novice like me, GDB is not so handy compared with debuggers in IDEs of other languages and the graphic debugger is not working....
0
votes
1answer
92 views

Pset 6 failing checks on indexes

I think these checks are related to indexes but I can't figure out where I have went wrong. :) server.c exists :) server compiles :) Requesting cat.jpg returns 200, image/jpeg, and correct image :) ...
0
votes
1answer
91 views

pset6 | Server.c | load and indexes doesn't work

I can't seem to find a problem in my load and indexes function. I need help. Thank you!! bool load(FILE* file, BYTE** content, size_t* length) { *content = NULL; *length = 0; BYTE temp; ...
0
votes
1answer
43 views

PSET6 Indexes wrong condition followed

I have run GDB on this section of code using http://localhost:8080/test/ To mimic the check50 test to see why my code is failing that test. When I did this, I got the following when info locals was ...
0
votes
1answer
129 views

pset6 server.c 403 forbidden for "/", problems for lookup and indexes

I finished all four functions to my best knowledge but the server seems not working well. Once I started the program and then tried to access https://ide50-(myusername).cs50.io/, 403 forbidden popped ...
0
votes
1answer
101 views

PSET6 again: pages not loading, but getting 200 OK

I've managed to pass the first check50 with all green, and I think there is nothing wrong with my load function, but my pages don't load when I click on the link. This happens with every link except ...
0
votes
1answer
92 views

Pset6 Unexpected end of input

On the first check I get all correct except error 404. Not sure where to implement that. After implementing Indexes and Load, I tried check50 only to get Unexpected end of input. Not sure how to debug ...
0
votes
1answer
86 views

Pset6 Indexes free() invalid next size error

I'm getting this error when I try to run my server. I don't what's been causing it. char* indexes(const char* path) { char* path_php = malloc(sizeof(char) * strlen(path)); char* path_html = ...
0
votes
1answer
79 views

pset6 indexes problem with string pointers

I am confused by the output of strcat. It seems to be adding characters to the beginning of a pointer. I am stepping through the index function in gdb and printing the values at pointers as I go. ...
0
votes
1answer
85 views

Pointer to char comes back empty

The parse function has 3 pointers that come into it; *line, *abs_path, and *query. I think I successfully manipulate the values at these addresses but when the function returns, *query is empty. *...
0
votes
1answer
319 views

pset6: PHP Templating and Indexes

I've been bashing my head for a few hours now. I finally was able to pass the server1 check50 last night, but the server2 check50 is killing me. Source: server.c: :) server.c exists :) server ...
0
votes
1answer
168 views

Pset6: server is functional but still failing a few checks

As stated, everything appears to work as it should when my server is running. The first check50 passes completely, but the second one fails on the following: ... :( Requesting favicon.ico returns 200,...
0
votes
1answer
1k views

Server.c Indexes function outputs weird code

I am pretty sure my other functions work - I pass all check50, except for the last line in check50 server1, where it's written TODO and the same for check50 server2. However, when I ran server in IDE,...
0
votes
1answer
191 views

Indexes function playing a sort of infinite loop

My indexes function recognizes some file's names (not all) and then continues to throw out garbarge data '\000' as file names. Here is the code I wrote for indexes: char* indexes(const char* path) { ...
0
votes
1answer
386 views

indexes function again

// TODO: Pseudocode // Allocate memory for (path/index.html and path/index.php, respectively) // copy path into char *pi // concatenate 'pi' with '/index.html' ('/index.php') // check if ...
0
votes
1answer
86 views

pset6 issues with indexes. Valgrind shows some errors

I'm currently working on pset6 and can't figure out what I'm doing wrong. I think the problem is the indexes function, because after running GDB I notices the program crashes as it passes that ...
0
votes
1answer
61 views

pset6 check50 test index.html fails

Finally I got Pset6 down to only one failing test. :( Requesting /test/ outputs /test/index.html As per the spec my program loads the index.html file in 'test' folder, which shows the Youtube video. ...
0
votes
1answer
41 views

problem with indexes function

its been a while i have been trying to get my index function right. I know I am close because there is only one error in check50.. The code looks fine to me. I can't figure out what is wrong with it.....
0
votes
1answer
74 views

Load and server not working, am confused

Am really trying to solve server.c though I don't really understand the specification for load and indexes functions. My parse and lookup seems to be working well, they passed check50 for server1 ...
0
votes
1answer
323 views

error message "Error in `./server': free(): invalid next size (fast): 0x0000000001daf660" when running server

I implemented load, parse, query, lookup and indexes, but now when I try to run the program and open up my Web Server from the CS50 IDE, I get the error message quoted in the title of this post. ...
0
votes
1answer
107 views

Pset6 server.c almost there

I spend a lot of time on this pset, and still got some errors which I can not figure out, so please help if you may. Here are errors cs50 checker sends me: :) server.c exists :) server compiles :) ...
0
votes
1answer
55 views

Server.c issues after completing indexes function

So I've been working on server.c and I have the the lookup, parse, and indexes function finished. With index passing back "index.php", "index.html", or NULL. It runs through that but when it gets to ...
0
votes
1answer
44 views

Indexes: what is wrong with my code?

This is my indexes function for pset 6: char* indexes(const char* path) { char php_path[] = "index.php"; char html_path[] = "index.html"; char full_php_path[strlen(path)+strlen(...
0
votes
1answer
133 views

Pset 6 load and index, totally confused

When i run my code i get a error proxy could not be processed request. During check50 2 everything is red with no reason as to why, I am thinking its a seg fault but valgrind didn't give one. Honestly,...
0
votes
1answer
133 views

Help pset6 load and indexes

I am getting these check50 errors can someone tell me in easy english what they are and why they are caused and the possible solution for it and if my approach to load and indexes functions are ...
0
votes
1answer
101 views

pset6 server.c not working properly

my server.c load and indexes functions are not working properly, and I'm not sure what's up. My parse and lookup functions pass all the tests. Any thoughts? bool load(FILE* file, BYTE** content, ...
0
votes
1answer
56 views

problem with return statement in indexes

When I go to compile my program I get the error: address of stack memory associated with local variable 'indexphp' returned. I think the problem is that indexphp is stored in the stack so I tried to ...
0
votes
1answer
350 views

Using access(path, F_OK) in indexes (pset6: server.c)

Based on the staff's use of access() in server.c and the documentation, I figured I could use it to see if the index.html/php exist. Unfortunately, whenever I try to use access, GDB tells me this ...
0
votes
1answer
123 views

Pset6: Getting 200 OK response, but cannot upload code to check50

Was wondering if anybody could take a look at my code and find any issues. I ran check50 after implementing lookup and parse, and I passed everything, so I am assuming the problem is in my load and/or ...
0
votes
1answer
1k views

server.c pset6 load and indexes function

I am getting 501 Not implemented on every file i open. Via valgrind i get the error many times: ==4890== Conditional jump or move depends on uninitialised value(s) ==4890== at 0x4C2F1D0: strcmp (...
0
votes
1answer
120 views

Pset6: load() and indexes(), not standard errors

My first two functions passed the check50, but the last two report not standard errors. Am I on the right track? Could anyone give me some hints? Thank you! load() bool load(FILE* file, BYTE** ...