Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
1
vote
Accepted
indexes function again
The function signature of strstr is
char *strstr(const char *haystack, const char *needle)
Since you have declared needle a const char*, you are violating the contract. I recommend further re …
1
vote
Indexes function playing a sort of infinite loop
Response to edit#1:
NB: The code post turned char* html = malloc(12); into this char html = malloc(12); which was only confusing for a little while :)
A major problem you are encountering is your …
0
votes
Accepted
problem with return statement in indexes
I would add that since indexes is expecting a char* as it's return value, that you should return a char*. …
1
vote
Accepted
Pset 6 failing checks on indexes
sizeof bad. char* temp_path = malloc(sizeof(path)); path is a pointer. sizeof a pointer is 4 or 8 depending on architecture. Looks like you want the length of the strings, which is a different functio …
1
vote
Accepted
Pset6: server is functional but still failing a few checks
How many bytes have you allocated to pathcopy? How many bytes are you trying to stuff in it? (Ditto pathcopy2). Once you fix that, make sure newpath is sized properly.
Also here's more trouble your …
1
vote
Accepted
Images Not Loading in Server.c, but Getting 200 OK Response
EDIT Sorry again for the misdirect. The elusive 1 eludes me at least once a day. This strncpy(storage, buffer, count); is causing a problem. Content can be anything. And content can have bytes with v …
1
vote
Accepted
Pointer to char comes back empty
Scope. Pointers. Look at the difference between the way you create abs_path and the way you create query. This strncpy(abs_path, reqtar, aplen); changes the contents of the memory that abs_path points …
0
votes
Accepted
Using access(path, F_OK) in indexes (pset6: server.c)
Yeah, gdb is "funny" about constants defined elsewhere. It has to do with optimization and compiler switches (and other stuff I know I don't know). Here's how the *_OKs are defined in unistd.h.
…
0
votes
Accepted
Help pset6 load and indexes
The other two errors indicate a problem in indexes, and specifically the second result
\ expected output, not an exit code of 0 indicates a seg-fault. … Remember, the spec only asks indexes to determine if either file actually exists in path. access is a function that does just that. …
1
vote
Accepted
PSET6 Indexes wrong condition followed
gdb hint: inspect the value of index in main after you return from indexes.
The real problem comes here: char* ptr_best = try1; (and try2 too). …
0
votes
Accepted
Server.c issues after completing indexes function
Suggest you look into the access function (man access). scandir implies to me that you are reading through the whole directory to look for either of the two specified files. One problem with that appr …
0
votes
Accepted
Pset6 server.c almost there
First problem, indexes, responsible for these errors:
:( Requesting /test/ outputs /test/index.html
:( Requesting directory containing index.php outputs index.php
From the specification: …
0
votes
Accepted
server.c pset6 load and indexes function
valgrind is complaining because you are treating a like a string e.g. strcmp(a,".css"), but you haven't created a string. The thing that makes a string a string is the terminating null byte. Your a do …
1
vote
Accepted
Pset6 Unexpected end of input
Unexpected end of input
Indicates a timeout on the check50 server. It has not processed your request. The only advice is "try again later".
error 404
Assuming you mean the "non_existAnt" fi …
1
vote
Pset6 problem in indexes and load function
Other things from a quick readthrough:
This didn't work in parse, it's not gonna work in indexes. … There are (other) fundamental problems in indexes. You need to go through it carefully and critically because it is not doing what the spec requires. …