Exemple #1
0
        public void SetHasParameter(bool hasParameter, ActuatorStaticDataCollection staticDataController = null)
        {
            if (staticDataController != null)
            {
                ActuatorStaticDataController = new FiddlerActuatorStaticDataCollectionController(staticDataController);
            }
            IsHasParameter = hasParameter;

            if (IsRawReplace)
            {
                if (HttpRawRequest != null)
                {
                    HttpRawRequest.SetUseParameterInfo(IsHasParameter, ActuatorStaticDataController.actuatorStaticDataCollection);
                }
            }
            else
            {
                if (UriModific != null && UriModific.ModificMode != ContentModificMode.NoChange)
                {
                    UriModific.SetUseParameterInfo(IsHasParameter, ActuatorStaticDataController.actuatorStaticDataCollection);
                }
                if (BodyModific != null && BodyModific.ModificMode != ContentModificMode.NoChange)
                {
                    BodyModific.SetUseParameterInfo(IsHasParameter, ActuatorStaticDataController.actuatorStaticDataCollection);
                }
            }
        }
Exemple #2
0
        public unsafe byte* Read(ByteReader r, HttpRawRequest request)
        {
            // field-value = *( field-content / obs-fold )
            // field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
            // field-vchar = VCHAR / obs-text
            // obs-fold = CRLF 1*( SP / HTAB )
            // obs-text = %x80-FF

            byte* pValueEnd = r.Position;
            while (r.Next().IsVcharOrObsTextOrSpaceOrTab())
                if (!r.Current.IsSpaceOrHtab())
                    pValueEnd = r.Position;

            byte c = r.Current;

            if (c == '\r' && r.Next() == '\n')
                return pValueEnd;
            throw new BadRequestException();
        }
        public byte* Read(ByteReader r, HttpRawRequest request)
        {
            // Transfer-Encoding = *( "," OWS ) transfer-coding *( OWS "," [ OWS transfer-coding ] )
            // transfer-coding = "chunked" / "compress" / "deflate" / "gzip" / transfer-extension
            // transfer-extension = token *( OWS ";" OWS transfer-parameter )
            // transfer-parameter = token BWS "=" BWS ( token / quoted-string )

            int hashCode = 0;
            byte c = r.Current;
            byte mappedC = c.MapTchar();
            if (mappedC != 0 || c == ',')
            {
                while (true)
                {
                    if (c == ',')
                    {
                        // skip '*( "," OWS )'
                        do
                        {
                            c = r.Next();
                        } while (c == ',' || c.IsSpaceOrHtab());

                        mappedC = c.MapTchar();
                    }

                    if (mappedC != c)
                    {
                        if (c == '\r')
                        {
                            if (r.Next() == '\n')
                            {
                                // TODO: return correct pointers
                                throw new NotImplementedException();
                            }
                            throw new BadRequestException();
                        }

                        if (mappedC == 0)
                            throw new BadRequestException();
                        r.ReplaceCurrent(mappedC);
                    }

                    // read 'token'
                    var tc = new TransferCoding();
                    tc.Name.Value.Start = r.Position;
                    do
                    {
                        hashCode = NativeByteArray.MixHash(hashCode, c = r.Next());
                    } while (c.IsTchar());

                    tc.Name.HashCode = hashCode;
                    tc.Name.Value.End = r.Position;

                    while (c.IsSpaceOrHtab())
                        c = r.Next();

                    if (c == '\r')
                    {
                        if (r.Next() == '\n')
                        {
                            // TODO: return correct pointers
                            throw new NotImplementedException();
                        }
                        throw new BadRequestException();
                    }

                    if (c == ';')
                    {
                        do
                        {
                            c = r.Next();
                        } while (c.IsSpaceOrHtab());

                        do
                        {
                            // TODO: read token
                            if (c.IsSpaceOrHtab())
                            {
                                do
                                {
                                    c = r.Next();
                                } while (c.IsSpaceOrHtab());
                            }
                            if (c != '=')
                                throw new BadRequestException();
                            do
                            {
                                c = r.Next();
                            } while (c.IsSpaceOrHtab());
                            // TODO: read token or quoted-string
                            if (c.IsSpaceOrHtab())
                            {
                                // TODO: save off pPos before whitespace
                                do
                                {
                                    c = r.Next();
                                } while (c.IsSpaceOrHtab());
                            }
                        } while (c == ';');
                    }
                    else if (c != ',')
                    {
                        throw new BadRequestException();
                    }
                }
            }

            throw new BadRequestException();
        }
 public void ReadEmpty(HttpRawRequest request)
 {
 }