MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sohashttpget

Function sohashttpget

freebsd/netinet/accf_http.c:151–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 } while(0)
150
151static int
152sohashttpget(struct socket *so, void *arg, int waitflag)
153{
154
155 if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 &&
156 !sbfull(&so->so_rcv)) {
157 struct mbuf *m;
158 char *cmp;
159 int cmplen, cc;
160
161 m = so->so_rcv.sb_mb;
162 cc = sbavail(&so->so_rcv) - 1;
163 if (cc < 1)
164 return (SU_OK);
165 switch (*mtod(m, char *)) {
166 case 'G':
167 STRSETUP(cmp, cmplen, "ET ");
168 break;
169 case 'H':
170 STRSETUP(cmp, cmplen, "EAD ");
171 break;
172 default:
173 goto fallout;
174 }
175 if (cc < cmplen) {
176 if (mbufstrncmp(m, m->m_nextpkt, 1, cc, cmp) == 1) {
177 DPRINT("short cc (%d) but mbufstrncmp ok", cc);
178 return (SU_OK);
179 } else {
180 DPRINT("short cc (%d) mbufstrncmp failed", cc);
181 goto fallout;
182 }
183 }
184 if (mbufstrcmp(m, m->m_nextpkt, 1, cmp) == 1) {
185 DPRINT("mbufstrcmp ok");
186 if (parse_http_version == 0)
187 return (soishttpconnected(so, arg, waitflag));
188 else
189 return (soparsehttpvers(so, arg, waitflag));
190 }
191 DPRINT("mbufstrcmp bad");
192 }
193
194fallout:
195 DPRINT("fallout");
196 return (SU_ISCONNECTED);
197}
198
199static int
200soparsehttpvers(struct socket *so, void *arg, int waitflag)

Callers

nothing calls this directly

Calls 6

sbfullFunction · 0.85
mbufstrncmpFunction · 0.85
mbufstrcmpFunction · 0.85
soishttpconnectedFunction · 0.85
soparsehttpversFunction · 0.85
sbavailFunction · 0.50

Tested by

no test coverage detected