Hello,
Thanks for all the replies.
We have so far discovered the following suggetions for the parsing Problem:
Using:
o a tokenizer/parser is too much overhead for such a simple task
o strchr, memchr is too low-level and not elegant enough
o strtok would not even parse (tokenize)
On Mon, May 02, 2011 at 02:13:11PM +0200, Martin Möller wrote:
o strchr, memchr is too low-level and not elegant enough
Actually, you are looking for strstr.
Joerg
___
freebsd-hackers@freebsd.org mailing list
Hi,
Am 02.05.2011 14:13, schrieb Martin Möller:
Criteria:
o Receive the value ofresource
o Check the Environment: Isresource really sourrounded by 'GET ' and
'HTTP/1.1' ?!
these quite simple criteria might be matched by code like this one:
char *ptr=NULL;
char *res=NULL;
On Mon, May 2, 2011 at 6:00 AM, Robert Schulze r...@bytecamp.net wrote:
Hi,
Am 02.05.2011 14:13, schrieb Martin Möller:
Criteria:
o Receive the value ofresource
o Check the Environment: Isresource really sourrounded by 'GET '
and
'HTTP/1.1' ?!
these quite simple criteria
Hi,
Am 02.05.2011 16:06, schrieb Artem Belevich:
Second problem -- res on success will always be as you've just did *ptr=0.
thats right, the copy should look like:
res=strdup(str+4);
Bzzt!
Try it on GET blah_HTTP/1.1.1.1.1.1_whatever HTTP/1.1
will return blah_HTTP/1.1.1.1.1.1_whatever
On Mon, May 2, 2011 at 7:15 AM, Robert Schulze r...@bytecamp.net wrote:
Hi,
Am 02.05.2011 16:06, schrieb Artem Belevich:
Second problem -- res on success will always be as you've just did
*ptr=0.
thats right, the copy should look like:
res=strdup(str+4);
Bzzt!
Try it on GET
For goodness sake, it's not even NP-complete.
char *start = strchr(line, ' ') + 1; char *end = strrchr(line, ' ');
char *ret;
*end = '\0';
ret = strdup(start);
*end = ' ';
return ret;
Obviously there's no error checking, but there you go. I don't see
what's inelegant about that.
This is C, use
Hi,
Am 02.05.2011 16:41, schrieb Artem Belevich:
if(ptr (ptr=strstr(ptr, HTTP/1.1))) /* find end of res */
Contrary to the comment in the code you're not checking for HTTP/1.1
at the end but you're checking for it *anywhere* in the string. While
it will occur at the end of valid
Hi,
On Mon, May 2, 2011 at 8:13 AM, Martin Möller
moeller@googlemail.com wrote:
Hello,
Thanks for all the replies.
We have so far discovered the following suggetions for the parsing Problem:
Using:
o a tokenizer/parser is too much overhead for such a simple task
o strchr, memchr
On Mon, May 2, 2011 at 8:57 AM, Arnaud Lacombe lacom...@gmail.com wrote:
Hi,
On Mon, May 2, 2011 at 8:13 AM, Martin Möller
moeller@googlemail.com wrote:
Hello,
Thanks for all the replies.
We have so far discovered the following suggetions for the parsing Problem:
Using:
o a
Am 01.05.11 00:53 schrieb Daniel O'Connor unter docon...@gsoft.com.au:
Thanks for your reply.
Ok, another example. I try to parse a request, coming from a client in the
form:
GET resource HTTP/1.1.
It is expected that resource can contain space characters (even if
its not the case in
On Sat, Apr 30, 2011 at 06:44:43PM +0200, Martin Möller wrote:
This is my first email to this list, so hello to all members.
The current version of sscanf, stops when a whitespace characters occurs in
a string
when the %s (string) type is used.
The following code:
char name [20], value
On Sun, May 01, 2011 at 04:45:14PM +0200, Martin M?ller wrote:
Am 01.05.11 00:53 schrieb Daniel O'Connor unter docon...@gsoft.com.au:
Thanks for your reply.
Ok, another example. I try to parse a request, coming from a client in the
form:
GET resource HTTP/1.1.
It is expected that
Hi to all,
This is my first email to this list, so hello to all members.
The current version of sscanf, stops when a whitespace characters occurs in
a string
when the %s¹ (string) type is used.
The following code:
char name [20], value [20];
sscanf (³Test 2-Test 3², ³%s-%s², name, value)
On 01/05/2011, at 2:14, Martin Möller wrote:
outputs total garbage on my FreeBSD-7.0-RELEASE #0 amd64.
Is there already a way to do this or should we release a new version of
sscanf, e.g. called sscanfWS.
This modified version would output: Test 2-Test 3.
I think it does what it should..
15 matches
Mail list logo